Просмотр исходного кода

Implemented cmake build for IDE.

Only on windows and linux so far, not yet tested on windows.

It also adds a new CMake/PolycodeDependencies.cmake that does most of the work of finding and linking polycode's dependencies for you. New cmake projects can just use this, and if something changes about polycode dependencies, we need only update one file.
cib 12 лет назад
Родитель
Сommit
cacf905997
2 измененных файлов с 222 добавлено и 0 удалено
  1. 100 0
      CMake/PolycodeDependencies.cmake
  2. 122 0
      IDE/Contents/CMakeLists.txt

+ 100 - 0
CMake/PolycodeDependencies.cmake

@@ -0,0 +1,100 @@
+# Find the required dependency libraries to use the polycode static library.
+#
+# Required variables by this cmake file:
+# ${POLYCODE_CMAKE_DIR} points to the directory with all of polycode's cmake scripts(including this one)
+# ${POLYCODE_RELEASE_DIR} points to the directory where the binares are produced to(Polycode/Release/${SYSTEM_NAME}) by default
+#
+# Sets ${POLYCODE_DEPENDENCY_LIBS} to something you can pass to TARGET_LINK_LIBRARIES
+# It will use the "debug" and "optimized" cmake keywords, so it will not work for anything other than TARGET_LINK_LIBRARIES
+#
+#
+# Uses INCLUDE_DIRECTORIES AND LINK_DIRECTORIES to add the necessary directories for the given links/includes to work.
+
+
+INCLUDE(${POLYCODE_CMAKE_DIR}/PolycodeIncludes.cmake)
+INCLUDE(${POLYCODE_CMAKE_DIR}/FindBullet.cmake)
+
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Include
+		${POLYCODE_RELEASE_DIR}/Framework/Core/include
+        ${POLYCODE_RELEASE_DIR}/Framework/Modules/include
+        ${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/include
+        ${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/include/AL
+        ${PolycodeIDE_SOURCE_DIR}/include)
+
+LINK_DIRECTORIES(${POLYCODE_RELEASE_DIR}/Framework/Core/lib
+        ${POLYCODE_RELEASE_DIR}/Framework/Modules/lib
+        ${POLYCODE_RELEASE_DIR}/Framework/Bindings/Lua/Core/lib
+		${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/lib)
+
+
+IF(MSVC OR MINGW)
+	SET(POLYCODE_DEPENDENCY_LIBS 
+        PolycodeLua_d
+        Polycore_d
+        ${ZLIB_LIBRARIES}
+        ${LUA_LIBRARY}
+        ${OPENGL_LIBRARIES}
+        ${OPENAL_LIBRARY}
+        ${PNG_LIBRARIES}
+        ${FREETYPE_LIBRARIES}
+        ${PHYSFS_LIBRARY}
+        ${OGG_LIBRARY}
+        ${VORBIS_LIBRARY}
+        ${VORBISFILE_LIBRARY}
+        opengl32
+        glu32
+        winmm
+        ws2_32
+		Polycode2DPhysics
+		Polycode3DPhysics
+		PolycodeUI
+		optimized ${BOX2D_RELEASE_LIBRARY}
+		debug ${BOX2D_DEBUG_LIBRARY}
+        optimized ${LIBBULLETMULTITHREADED}
+        optimized ${LIBBULLETSOFTBODY}
+        optimized ${LIBBULLETDYNAMICS}
+        optimized ${LIBBULLETCOLLISION}
+        optimized ${LIBBULLETMATH}
+        debug ${LIBBULLETMULTITHREADED_DEBUG}
+        debug ${LIBBULLETSOFTBODY_DEBUG}
+        debug ${LIBBULLETDYNAMICS_DEBUG}
+        debug ${LIBBULLETCOLLISION_DEBUG}
+        debug ${LIBBULLETMATH_DEBUG})
+ELSEIF(APPLE)
+	# TODO: Add apple support
+ELSE(MSVC OR MINGW)
+	SET(POLYCODE_DEPENDENCY_LIBS 
+		rt
+		pthread
+		PolycodeLua_d
+		PolycodeUI_d
+		Polycore_d
+		${LUA_LIBRARY}
+		${FREETYPE_LIBRARIES}
+		${VORBISFILE_LIBRARY}
+		${VORBIS_LIBRARY}
+		${OGG_LIBRARY}
+		${OPENAL_LIBRARY}
+		${PHYSFS_LIBRARY}
+		${PNG_LIBRARIES}
+		${ZLIB_LIBRARY}
+		${OPENGL_LIBRARIES}
+		${SDL_LIBRARY}
+		dl
+		Polycode2DPhysics_d
+		Polycode3DPhysics_d
+		${BOX2D_RELEASE_LIBRARY}
+
+		optimized ${LIBBULLETMULTITHREADED}
+		optimized ${LIBBULLETSOFTBODY}
+		optimized ${LIBBULLETDYNAMICS}
+		optimized ${LIBBULLETCOLLISION}
+		optimized ${LIBBULLETMATH}
+
+		debug ${LIBBULLETMULTITHREADED_DEBUG}
+		debug ${LIBBULLETSOFTBODY_DEBUG}
+		debug ${LIBBULLETDYNAMICS_DEBUG}
+		debug ${LIBBULLETCOLLISION_DEBUG}
+		debug ${LIBBULLETMATH_DEBUG})
+ENDIF(MSVC OR MINGW)

+ 122 - 0
IDE/Contents/CMakeLists.txt

@@ -0,0 +1,122 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+PROJECT(PolycodeIDE)
+
+SET(POLYCODE_ROOT_DIR ${PolycodeIDE_SOURCE_DIR}/../../)
+SET(POLYCODE_RELEASE_DIR ${POLYCODE_ROOT_DIR}/Release/${CMAKE_SYSTEM_NAME})
+SET(POLYCODE_CMAKE_DIR ${POLYCODE_ROOT_DIR}/CMake)
+SET(CMAKE_INSTALL_PREFIX ${POLYCODE_RELEASE_DIR}/Standalone/)
+
+SET(CMAKE_PREFIX_PATH
+    ${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies
+    ${POLYCODE_RELEASE_DIR}/Framework/Modules/Dependencies
+    ${POLYCODE_RELEASE_DIR}/Framework/Tools/Dependencies)
+
+SET(CMAKE_DEBUG_POSTFIX "_d")
+SET(CMAKE_MODULE_PATH ${POLYCODE_ROOT_DIR}/CMake)
+INCLUDE(${POLYCODE_CMAKE_DIR}/PolycodeDependencies.cmake)
+
+IF(MSVC OR MINGW)
+	SET(MAIN_CPP ../Build/Windows/main.cpp)
+ELSEIF(APPLE)
+		MESSAGE("Target system not currently supported.")
+ELSE(MSVC OR MINGW)
+	SET(MAIN_CPP ../Build/Linux/main.cpp)
+ENDIF(MSVC OR MINGW)
+
+
+SET(PolycodeIDE_SRCS
+		${MAIN_CPP}
+		Source/ExampleBrowserWindow.cpp
+		Source/PolycodeProject.cpp
+		Source/ExportProjectWindow.cpp
+		Source/PolycodeProjectBrowser.cpp
+		Source/NewFileWindow.cpp
+		Source/PolycodeProjectEditor.cpp
+		Source/NewProjectWindow.cpp
+		Source/PolycodeProjectManager.cpp
+		Source/PolycodeClipboard.cpp
+		Source/PolycodeProps.cpp
+		Source/PolycodeConsole.cpp
+		Source/PolycodeRemoteDebugger.cpp
+		Source/PolycodeEditor.cpp
+		Source/PolycodeScreenEditor.cpp
+		Source/PolycodeEditorManager.cpp
+		Source/PolycodeSpriteEditor.cpp
+		Source/PolycodeFontEditor.cpp
+		Source/PolycodeTextEditor.cpp
+		Source/PolycodeFrame.cpp
+		Source/PolycodeToolLauncher.cpp
+		Source/PolycodeIDEApp.cpp
+		Source/SettingsWindow.cpp
+		Source/PolycodeImageEditor.cpp
+		Source/TextureBrowser.cpp
+		Source/PolycodeMaterialEditor.cpp
+		Source/ToolWindows.cpp
+)
+
+SET(PolycodeIDE_HDRS
+		Include/ExampleBrowserWindow.h
+		Include/PolycodeFrame.h
+		Include/PolycodeProps.h
+		Include/ExportProjectWindow.h
+		Include/PolycodeGlobals.h
+		Include/PolycodeRemoteDebugger.h
+		Include/NewFileWindow.h
+		Include/PolycodeIDEApp.h
+		Include/PolycodeScreenEditor.h
+		Include/NewProjectWindow.h
+		Include/PolycodeImageEditor.h
+		Include/PolycodeSpriteEditor.h
+		Include/PolycodeClipboard.h
+		Include/PolycodeMaterialEditor.h
+		Include/PolycodeTextEditor.h
+		Include/PolycodeConsole.h
+		Include/PolycodeProject.h
+		Include/PolycodeToolLauncher.h
+		Include/PolycodeEditor.h
+		Include/PolycodeProjectBrowser.h
+		Include/SettingsWindow.h
+		Include/PolycodeEditorManager.h
+		Include/PolycodeProjectEditor.h
+		Include/TextureBrowser.h
+		Include/PolycodeFontEditor.h
+		Include/PolycodeProjectManager.h
+		Include/ToolWindows.h
+
+)
+
+INSTALL(FILES ${POLYCODE_ROOT_DIR}/LICENSE.txt
+		DESTINATION ./)
+
+# WIN32 makes it build a GUI application on windows(no effect on other platforms)
+ADD_EXECUTABLE(PolycodeIDE WIN32 ${PolycodeIDE_SRCS} ${PolycodeIDE_HDRS})
+
+IF(MSVC OR MINGW)
+	INSTALL(FILES ${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/bin/OpenAL32.dll DESTINATION bin)
+	INSTALL(FILES ${POLYCODE_RELEASE_DIR}/Framework/Player/default.pak DESTINATION bin)
+	INSTALL(FILES ${POLYCODE_RELEASE_DIR}/Framework/Player/hdr.pak DESTINATION bin)
+	INSTALL(FILES ${POLYCODE_RELEASE_DIR}/Framework/Player/api.pak DESTINATION bin)
+	INSTALL(FILES ${POLYCODE_RELEASE_DIR}/Framework/Player/UI.pak DESTINATION bin)
+	INSTALL(FILES ${POLYCODE_RELEASE_DIR}/Framework/Player/Physics2D.pak DESTINATION bin)
+	INSTALL(FILES ${POLYCODE_RELEASE_DIR}/Framework/Player/Physics3D.pak DESTINATION bin)
+
+	TARGET_LINK_LIBRARIES(PolycodeIDE
+		${POLYCODE_DEPENDENCY_LIBS}
+     )
+
+ELSEIF(APPLE)
+		MESSAGE("Target system not currently supported.")
+ELSE(MSVC OR MINGW)
+	TARGET_LINK_LIBRARIES(PolycodeIDE
+		${POLYCODE_DEPENDENCY_LIBS}
+	)
+	
+	# Install resources etc. after the build is finished
+	ADD_CUSTOM_COMMAND(TARGET PolycodeIDE POST_BUILD 
+		COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Resources/ ${CMAKE_BINARY_DIR}
+		COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../../Release/Linux/Framework/Core/Assets/default.pak ${CMAKE_BINARY_DIR}
+		COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../../Release/Linux/Standalone ${CMAKE_BINARY_DIR}
+	)
+
+ENDIF(MSVC OR MINGW)