SHARE
TWEET

FmAL

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