Przeglądaj źródła

disable by default cmake file for editor, seems to be working
- requires Qt 5
- requires cmake 2.8.7

Ivan Savenko 12 lat temu
rodzic
commit
b169326940
2 zmienionych plików z 54 dodań i 0 usunięć
  1. 9 0
      CMakeLists.txt
  2. 45 0
      Editor/CMakeLists.txt

+ 9 - 0
CMakeLists.txt

@@ -10,6 +10,7 @@ if (NOT CMAKE_BUILD_TYPE)
 endif()
 endif()
 
 
 option(DISABLE_ERM "Disable compilation of ERM scripting module" ON)
 option(DISABLE_ERM "Disable compilation of ERM scripting module" ON)
+option(ENABLE_EDITOR "Enable compilation of map editor" OFF)
 
 
 ############################################
 ############################################
 #        Building section                  #
 #        Building section                  #
@@ -41,6 +42,11 @@ find_package(SDL_mixer REQUIRED)
 find_package(SDL_ttf REQUIRED)
 find_package(SDL_ttf REQUIRED)
 find_package(ZLIB REQUIRED)
 find_package(ZLIB REQUIRED)
 
 
+if (ENABLE_EDITOR)
+	# Widgets finds its own dependencies (QtGui and QtCore).
+	find_package(Qt5Widgets REQUIRED)
+endif()
+
 if(NOT WIN32)
 if(NOT WIN32)
 	set(FFmpeg_FIND_COMPONENTS AVFORMAT SWSCALE)
 	set(FFmpeg_FIND_COMPONENTS AVFORMAT SWSCALE)
 	find_package(FFmpeg REQUIRED)
 	find_package(FFmpeg REQUIRED)
@@ -101,6 +107,9 @@ add_subdirectory(AI)
 if (NOT DISABLE_ERM)
 if (NOT DISABLE_ERM)
 	add_subdirectory(Scripting/ERM)
 	add_subdirectory(Scripting/ERM)
 endif()
 endif()
+if (ENABLE_EDITOR)
+	add_subdirectory(Editor)
+endif()
 
 
 #######################################
 #######################################
 #    Installation section             #
 #    Installation section             #

+ 45 - 0
Editor/CMakeLists.txt

@@ -0,0 +1,45 @@
+project(vcmieditor)
+cmake_minimum_required(VERSION 2.8.7)
+
+include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${Qt5Widgets_INCLUDE_DIRS})
+
+
+set(maped_SRCS
+	Editor.cpp
+	Main.cpp
+)
+
+set(maped_MOC_HEADERS
+	Editor.h
+)
+
+set(maped_FORMS
+	editor.ui
+)
+
+# Tell CMake to run moc when necessary:
+set(CMAKE_AUTOMOC ON)
+
+# As moc files are generated in the binary dir, tell CMake
+# to always look for includes there:
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+# We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
+add_definitions(${Qt5Widgets_DEFINITIONS})
+
+# Executables fail to build with Qt 5 in the default configuration
+# without -fPIE. We add that here.
+set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+qt5_wrap_ui(maped_FORMS_OUT ${maped_FORMS})
+
+add_executable(vcmieditor ${maped_SRCS} ${maped_FORMS_OUT})
+
+# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
+target_link_libraries(vcmieditor vcmi ${Qt5Widgets_LIBRARIES})
+
+if (NOT APPLE) # Already inside bundle
+    install(TARGETS vcmieditor DESTINATION ${BIN_DIR})
+endif()
+