Advertisement
Danicron

DemonspawnofHell

Jan 8th, 2020
1,389
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PROJECT (OPENC2E CXX C)
  2.  
  3. SET(SRC "${OPENC2E_SOURCE_DIR}")
  4. SET(BIN "${OPENC2E_BINARY_DIR}")
  5. SET(GEN "${BIN}/generated")
  6. EXECUTE_PROCESS(COMMAND mkdir -p "${GEN}")
  7.  
  8. SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1)
  9. SET(CMAKE_MODULE_PATH "${SRC}/cmake")
  10.  
  11. SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "The type of build to perform. Valid values are: RelWithDebInfo (default), Debug, Release, MinSizeRel")
  12. IF (CMAKE_BUILD_TYPE STREQUAL "")
  13.     SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "The type of build to perform. Valid values are: RelWithDebInfo (default), Debug, Release, MinSizeRel" FORCE)
  14. ENDIF (CMAKE_BUILD_TYPE STREQUAL "")
  15.  
  16. SET(OPENC2E_USE_QT "TRUE" CACHE BOOL "Build the qt GUI")
  17. SET(OPENC2E_USE_OPENAL "AUTO" CACHE STRING "Use OpenAL (YES/NO/AUTO)")
  18. IF (OPENC2E_USE_OPENAL MATCHES "^(YES|NO|AUTO)$")
  19. ELSE (OPENC2E_USE_OPENAL MATCHES "^(YES|NO|AUTO)$")
  20.     MESSAGE(SEND_ERROR "The value of OPENC2E_USE_OPENAL must be YES, NO, or AUTO.")
  21. ENDIF (OPENC2E_USE_OPENAL MATCHES "^(YES|NO|AUTO)$")
  22.  
  23. SET(OPENC2E_USE_SERIALIZATION "FALSE" CACHE BOOL "Build the experimental serialization code")
  24. MARK_AS_ADVANCED(FORCE OPENC2E_USE_SERIALIZATION)
  25. IF (OPENC2E_USE_SERIALIZATION)
  26.     SET(SER_SRCS src/caos/caosVM_ser_real.cpp)
  27. ELSE (OPENC2E_USE_SERIALIZATION)
  28.     SET(SER_SRCS src/caos/caosVM_ser_stub.cpp)
  29. ENDIF (OPENC2E_USE_SERIALIZATION)
  30.  
  31. SET(OPENC2E_PROFILE_ALLOCATION "FALSE" CACHE BOOL "Collect allocation profile stats for DBG: SIZO")
  32. MARK_AS_ADVANCED(FORCE OPENC2E_PROFILE_ALLOCATION)
  33. IF (OPENC2E_PROFILE_ALLOCATION)
  34.     ADD_DEFINITIONS("-DPROFILE_ALLOCATION_COUNT -DPROFILE_ALLOCATION_THREAD_SAFE")
  35. ENDIF (OPENC2E_PROFILE_ALLOCATION)
  36.  
  37. SET(OPENC2E_CORE
  38.     src/Agent.cpp
  39.     src/AgentHelpers.cpp
  40.     src/AgentRef.cpp
  41.     src/alloc_count.cpp
  42.     src/creatures/attFile.cpp
  43.     src/Backend.cpp
  44.     src/creatures/Biochemistry.cpp
  45.     src/Blackboard.cpp
  46.     src/images/blkImage.cpp
  47.     src/images/bmpImage.cpp
  48.     src/Bubble.cpp
  49.     src/bytecode.cpp
  50.     src/images/c16Image.cpp
  51.     src/creatures/c2eBrain.cpp
  52.     src/CallButton.cpp
  53.     src/Camera.cpp
  54.     src/caosScript.cpp
  55.     src/caosVar.cpp
  56.     src/caos/caosVM_agent.cpp
  57.     src/caos/caosVM_camera.cpp
  58.     src/caos/caosVM_compound.cpp
  59.     src/caos/caosVM_core.cpp
  60.     src/caos/caosVM_creatures.cpp
  61.     src/caos/caosVM_debug.cpp
  62.     src/caos/caosVM_files.cpp
  63.     src/caos/caosVM_flow.cpp
  64.     src/caos/caosVM_genetics.cpp
  65.     src/caos/caosVM_history.cpp
  66.     src/caos/caosVM_input.cpp
  67.     src/caos/caosVM_map.cpp
  68.     src/caos/caosVM_motion.cpp
  69.     src/caos/caosVM_net.cpp
  70.     src/caosVM.cpp
  71.     src/caos/caosVM_ports.cpp
  72.     src/caos/caosVM_resources.cpp
  73.     src/caos/caosVM_scripts.cpp
  74.     src/caos/caosVM_sounds.cpp
  75.     src/caos/caosVM_time.cpp
  76.     src/caos/caosVM_variables.cpp
  77.     src/caos/caosVM_vectors.cpp
  78.     src/caos/caosVM_vehicles.cpp
  79.     src/caos/caosVM_world.cpp
  80.     ${GEN}/cataloglexer.cpp
  81.     src/Catalogue.cpp
  82.     ${GEN}/catalogue.tab.cpp
  83.     ${GEN}/cmddata.cpp
  84.     src/cobFile.cpp
  85.     src/CompoundAgent.cpp
  86.     src/creatures/CompoundCreature.cpp
  87.     src/CompoundPart.cpp
  88.     src/creatures/Creature.cpp
  89.     src/creatures/CreatureAgent.cpp
  90.     src/creatures/CreatureAI.cpp
  91.     src/creaturesImage.cpp
  92.     src/dialect.cpp
  93.     src/Engine.cpp
  94.     src/exceptions.cpp
  95.     src/fileSwapper.cpp
  96.     src/creatures/genomeFile.cpp
  97.     src/historyManager.cpp
  98.     src/imageManager.cpp
  99.     ${GEN}/mnglexer.cpp
  100.     ${GEN}/caoslexer.cpp
  101.     src/Lift.cpp
  102.     src/Map.cpp
  103.     src/MetaRoom.cpp
  104.     src/mmapifstream.cpp
  105.     src/music/mngfile.cpp
  106.     ${GEN}/mngparser.tab.cpp
  107.     src/MusicManager.cpp
  108.     src/creatures/oldBrain.cpp
  109.     src/PathResolver.cpp
  110.     src/peFile.cpp
  111.     src/physics.cpp
  112.     src/PointerAgent.cpp
  113.     src/Port.cpp
  114.     src/pray.cpp
  115.     src/prayManager.cpp
  116.     src/renderable.cpp
  117.     src/Room.cpp
  118.     src/Scriptorium.cpp
  119.     src/SFCFile.cpp
  120.     src/SimpleAgent.cpp
  121.     src/creatures/SkeletalCreature.cpp
  122.     src/images/sprImage.cpp
  123.     src/streamutils.cpp
  124.     src/Vehicle.cpp
  125.     src/VoiceData.cpp
  126.     src/World.cpp
  127.     src/main.cpp
  128.     src/util.cpp
  129. )
  130. SET(OPENC2E_SDL
  131.     src/backends/SDLBackend.cpp
  132. )
  133.  
  134.  
  135. SET(OPENC2E_QT
  136.     src/backends/qtgui/qtopenc2e.cpp
  137.     src/backends/qtgui/openc2eview.cpp
  138.     src/backends/qtgui/AgentInjector.cpp
  139.     src/backends/qtgui/BrainViewer.cpp
  140.     src/backends/qtgui/imagepreview.cpp
  141.     src/backends/qtgui/c1cobfile.cpp
  142.     src/backends/qtgui/QtBackend.cpp
  143.     src/backends/qtgui/GraphWidget.cpp
  144.     src/backends/qtgui/CreatureGrapher.cpp
  145.     src/backends/qtgui/ChemicalSelector.cpp
  146.     src/backends/qtgui/Hatchery.cpp
  147.     src/tools/braininavat/brainview.cpp)
  148.  
  149. SET(OPENC2E_QT_MOC_HDRS
  150.     src/backends/qtgui/qtopenc2e.h
  151.     src/backends/qtgui/openc2eview.h
  152.     src/backends/qtgui/AgentInjector.h
  153.     src/backends/qtgui/BrainViewer.h
  154.     src/backends/qtgui/imagepreview.h
  155.     src/backends/qtgui/GraphWidget.h
  156.     src/backends/qtgui/CreatureGrapher.h
  157.     src/backends/qtgui/ChemicalSelector.h
  158.     src/backends/qtgui/Hatchery.h
  159.     src/tools/braininavat/brainview.h)
  160.  
  161. SET(OPENC2E_QT_UIS
  162.     src/backends/qtgui/agents.ui)
  163. #
  164.  
  165.  
  166. cmake_minimum_required(VERSION 2.4.0)
  167. INCLUDE(TestBigEndian)
  168. INCLUDE(CheckIncludeFile)
  169. TEST_BIG_ENDIAN(BIG_ENDIAN)
  170. IF(BIG_ENDIAN)
  171.     ADD_DEFINITIONS("-DOC2E_BIG_ENDIAN=1")
  172.     CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
  173.     IF(HAVE_BYTESWAP_H)
  174.         ADD_DEFINITIONS("-DHAVE_BYTESWAP_H=1")
  175.     ELSE(HAVE_BYTESWAP_H)
  176.         ADD_DEFINITIONS("-DHAVE_BYTESWAP_H=0")
  177.     ENDIF(HAVE_BYTESWAP_H)
  178. ELSE(BIG_ENDIAN)
  179.     ADD_DEFINITIONS("-DOC2E_BIG_ENDIAN=0")
  180. ENDIF(BIG_ENDIAN)
  181. CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
  182. IF(HAVE_STDINT_H)
  183.     ADD_DEFINITIONS("-DHAVE_STDINT_H=1")
  184. ELSE(HAVE_STDINT_H)
  185. ENDIF(HAVE_STDINT_H)
  186.  
  187. set(SDL2_INCLUDE_DIR "C:/SDL2-2.0.10/include")
  188. set(SDL2_LIBRARY "C:/SDL2-2.0.10/lib")
  189. set(SDL2_MIXER_DIR "C:/SDL2_mixer-2.0.4")
  190. set(SDL2_NET_DIR "C:/SDL2_net-2.0.1")
  191. set(SDL2_GFX_DIR "C:/SDL2_gfx-1.0.1")
  192. set(SDL2_TTF_DIR "C:/SDL2_ttf-2.0.15")
  193.  
  194. IF(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$")
  195.     FIND_PACKAGE(OpenAL)
  196. ELSE(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$")
  197.     SET(OPENAL_FOUND "NO")
  198. ENDIF(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$")
  199. FIND_PACKAGE(ALUT)
  200.  
  201. set(Zlib_DIR "C:/zlib")
  202. set(BOOST_ROOT "C:/local/boost_1_72_0")
  203. set(BOOST_LIBRARYDIR "C:/local/boost_1_72_0/lib32")
  204.  
  205. FIND_PACKAGE(Boost 1.46.0 COMPONENTS program_options filesystem thread regex serialization REQUIRED)
  206. FIND_LIBRARY(BOOST_SYSTEM_LIBRARY NAMES boost_system)
  207.  
  208. IF(OPENC2E_USE_QT)
  209.     find_package(Qt4 REQUIRED)
  210. ENDIF(OPENC2E_USE_QT)
  211.  
  212. SET(USE_OPENAL "NO")
  213.  
  214. IF(OPENAL_FOUND)
  215.     IF(ALUT_FOUND)
  216.         SET(USE_OPENAL "YES")
  217.     ENDIF(ALUT_FOUND)
  218. ENDIF(OPENAL_FOUND)
  219.      
  220. IF(USE_OPENAL STREQUAL "NO")
  221.     IF (OPENC2E_USE_OPENAL MATCHES "^YES")
  222.         MESSAGE(FATAL_ERROR "OpenAL not found.")
  223.     ENDIF (OPENC2E_USE_OPENAL MATCHES "^YES")
  224.    
  225.     SET(ALUT_INCLUDE_DIR "")
  226.     SET(OPENAL_INCLUDE_DIR "")
  227.     SET(ALUT_LIBRARY "")
  228.     SET(OPENAL_LIBRARY "")
  229.     SET(OPENAL_SRC "")
  230.     SET(OPENAL_DEF "")
  231. ELSE(USE_OPENAL STREQUAL "NO")
  232.     SET(OPENAL_SRC "src/backends/OpenALBackend.cpp")
  233.     SET(OPENAL_DEF "-DOPENAL_SUPPORT")
  234. ENDIF(USE_OPENAL STREQUAL "NO")
  235.  
  236. IF(SDLMIXER_FOUND)
  237.     SET(SDLMIXER_SRC "src/backends/SDLMixerBackend.cpp")
  238.     SET(SDLMIXER_DEF "-DSDLMIXER_SUPPORT")
  239. ELSE(SDLMIXER_FOUND)
  240.     SET(SDLMIXER_INCLUDE_DIR "")
  241.     SET(SDLMIXER_LIBRARY "")
  242.     SET(SDLMIXER_SRC "")
  243.     SET(SDLMIXER_DEF "")
  244. ENDIF(SDLMIXER_FOUND)
  245.  
  246. IF(OPENC2E_USE_QT)
  247.     include(${QT_USE_FILE})
  248.     SET(SAVED_CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_BINARY_DIR)
  249.     SET(CMAKE_CURRENT_BINARY_DIR ${GEN})
  250.     QT4_WRAP_UI(OPENC2E_QT_UIS_H ${OPENC2E_QT_UIS})
  251.     QT4_WRAP_CPP(OPENC2E_QT_MOC_SRCS ${OPENC2E_QT_MOC_HDRS})
  252.     SET(CMAKE_CURRENT_BINARY_DIR SAVED_CMAKE_CURRENT_BINARY_DIR)
  253.     SET(QT_DEF "-DQT_SUPPORT")
  254. ENDIF(OPENC2E_USE_QT)
  255.  
  256. # Pass flags to the compiler
  257. ADD_DEFINITIONS("-W0 -D_REENTRANT -DYYERROR_VERBOSE ${OPENAL_DEF} ${QT_DEF} ${SDLMIXER_DEF}")
  258.  
  259. IF(OPENC2E_USE_QT)
  260.     SET(FRONTEND_SRCS ${OPENC2E_SDL} ${OPENC2E_QT} ${OPENC2E_QT_UIS_H} ${OPENC2E_QT_MOC_SRCS})
  261.     SET(FRONTEND_LIBS ${QT_LIBRARIES})
  262. ELSE(OPENC2E_USE_QT)
  263. SET(FRONTEND_SRCS ${OPENC2E_SDL})
  264.     SET(FRONTEND_LIBS)
  265. ENDIF(OPENC2E_USE_QT)
  266. ADD_EXECUTABLE(openc2e ${OPENC2E_CORE} ${FRONTEND_SRCS} ${OPENAL_SRC} ${SDLMIXER_SRC} ${SER_SRCS})
  267.  
  268. TARGET_LINK_LIBRARIES(
  269.     openc2e
  270.     #${BOOST_LIBRARY_DIR}
  271.     ${SDL_LIBRARY}
  272.     ${SDL2_NET_DIR}/lib
  273.     ${SDL2_TTF_DIR}/lib
  274.     ${SDL2_GFX_DIR}/Win32/Debug
  275.     ${SDL2_MIXER_DIR}/lib
  276.     ${Zlib_DIR}/lib
  277.     ${OPENAL_LIBRARY}
  278.     ${ALUT_LIBRARY}
  279.     ${FRONTEND_LIBS}
  280.    
  281.     )
  282. IF(BOOST_SYSTEM_LIBRARY)
  283. Message("Boost Library Found")
  284. TARGET_LINK_LIBRARIES(openc2e boost_system)
  285. ENDIF(BOOST_SYSTEM_LIBRARY)
  286.  
  287. LINK_DIRECTORIES(${Boost_LIBRARY})
  288.  
  289. INCLUDE_DIRECTORIES(BEFORE
  290.     ${GEN}
  291.     ${SRC}/src
  292.     ${SDL2_INCLUDE_DIR}
  293.     ${SDL2_NET_DIR}/include
  294.     ${SDL2_TTF_DIR}/include
  295.     ${SDL2_GFX_DIR}
  296.     ${SDL2_MIXER_DIR}/include
  297.     ${OPENAL_INCLUDE_DIR}
  298.     ${ALUT_INCLUDE_DIR}
  299.     ${Zlib_DIR}/include
  300.     ${Boost_INCLUDE_DIR}
  301.     )
  302.  
  303. FILE(GLOB CAOSVM_FILES ${SRC}/src/caos/caosVM_*.cpp)
  304.  
  305. if(LINUX)
  306. ADD_CUSTOM_COMMAND(
  307.     OUTPUT ${GEN}/commandinfo.yml
  308.     COMMAND perl parsedocs.pl ${CAOSVM_FILES} > ${GEN}/commandinfo.yml
  309.     DEPENDS parsedocs.pl ${CAOSVM_FILES}
  310.     WORKING_DIRECTORY ${SRC})
  311.  
  312. ADD_CUSTOM_COMMAND(
  313.     OUTPUT ${BIN}/caosdocs.html
  314.     COMMAND perl docs/writehtml.pl ${GEN}/commandinfo.yml > ${BIN}/caosdocs.html
  315.     DEPENDS docs/writehtml.pl ${GEN}/commandinfo.yml
  316.     WORKING_DIRECTORY ${SRC})
  317. ADD_CUSTOM_COMMAND(
  318.     OUTPUT ${BIN}/docs.css
  319.     COMMAND cp docs/docs.css ${BIN}/docs.css
  320.     DEPENDS docs/docs.css
  321.     WORKING_DIRECTORY ${SRC})
  322. ADD_CUSTOM_COMMAND(
  323.     OUTPUT ${BIN}/openc2e.6
  324.     COMMAND pod2man --center="Openc2e Documentation" --section=6 ${SRC}/docs/openc2e.pod ${BIN}/openc2e.6
  325.     DEPENDS docs/openc2e.pod
  326.     )
  327. # it seems these ADD_CUSTOM_COMMANDS for flex and bison could be made
  328. # into a macro... e.g. FLEX(file1) FLEX(file2) etc...
  329. ADD_CUSTOM_COMMAND(
  330.     OUTPUT ${GEN}/cataloglexer.cpp
  331.     COMMAND re2c -o ${GEN}/cataloglexer.cpp ${SRC}/src/cataloglexer.re2c
  332.     DEPENDS ${SRC}/src/cataloglexer.re2c
  333.     WORKING_DIRECTORY ${SRC})
  334.  
  335. ADD_CUSTOM_COMMAND(
  336.     OUTPUT ${GEN}/catalogue.tab.cpp ${GEN}/catalogue.tab.hpp
  337.     COMMAND bison -d --name-prefix=cata --file-prefix="${GEN}/catalogue" src/catalogue.ypp
  338.     DEPENDS src/catalogue.ypp
  339.     WORKING_DIRECTORY ${SRC})
  340.  
  341. ADD_CUSTOM_COMMAND(
  342.     OUTPUT ${GEN}/cmddata.cpp
  343.     COMMAND perl writecmds.pl ${GEN}/commandinfo.yml > ${GEN}/cmddata.cpp
  344.     DEPENDS ${GEN}/commandinfo.yml writecmds.pl
  345.     WORKING_DIRECTORY ${SRC})
  346.  
  347. ADD_CUSTOM_COMMAND(
  348.     OUTPUT ${GEN}/caoslexer.cpp
  349.     COMMAND re2c -o ${GEN}/caoslexer.cpp ${SRC}/src/caoslexer.re2c
  350.     DEPENDS ${SRC}/src/caoslexer.re2c
  351.     WORKING_DIRECTORY ${SRC})
  352.  
  353. ADD_CUSTOM_COMMAND(
  354.     OUTPUT ${GEN}/mnglexer.cpp
  355.     COMMAND re2c -o ${GEN}/mnglexer.cpp ${SRC}/src/music/mnglexer.re2c
  356.     DEPENDS ${SRC}/src/music/mnglexer.re2c
  357.     WORKING_DIRECTORY ${SRC})
  358.  
  359. ADD_CUSTOM_COMMAND(
  360.     OUTPUT ${GEN}/mngparser.tab.cpp ${GEN}/mngparser.tab.hpp
  361.     COMMAND bison -d --name-prefix=mng --file-prefix="${GEN}/mngparser" src/music/mngparser.ypp
  362.     DEPENDS src/music/mngparser.ypp
  363.     WORKING_DIRECTORY ${SRC})
  364.  
  365. ADD_CUSTOM_TARGET(test DEPENDS openc2e
  366.     COMMAND perl ${SRC}/runtests.pl ${SRC}/tests)
  367. ADD_CUSTOM_TARGET(docs ALL DEPENDS ${BIN}/caosdocs.html ${BIN}/docs.css ${BIN}/openc2e.6)
  368. ADD_CUSTOM_TARGET(generated DEPENDS
  369.     ${GEN}/catalogue.tab.cpp ${GEN}/catalogue.tab.hpp
  370.     ${GEN}/caoslexer.cpp
  371.     ${GEN}/mngparser.tab.cpp ${GEN}/mngparser.tab.hpp
  372.     ${GEN}/mnglexer.cpp
  373.     ${GEN}/cataloglexer.cpp
  374.     ${GEN}/cmddata.cpp
  375. )
  376. endif(LINUX)
Advertisement
RAW Paste Data Copied
Advertisement