SHARE
TWEET

fmlfmlfmlfmlfml

Danicron Aug 12th, 2019 78 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.  
  131. SET(OPENC2E_SDL
  132.     src/backends/SDLBackend.cpp
  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_LIBRARY "C:\SDL2-2.0.10\include\SDL_mixer-7f804ba2c5fc\VisualC\playmus\Win32")
  188. set(SDL2_INCLUDE_DIR "C:\SDL2-2.0.10\include")
  189. set(SDL2_net "C:\SDL2_net-2.0.1")
  190.  
  191. FIND_PACKAGE(SDL2 REQUIRED)
  192. FIND_PACKAGE(SDL2_mixer)
  193. FIND_PACKAGE(SDL2_net REQUIRED)
  194. FIND_PACKAGE(SDL2_gfx REQUIRED)
  195. FIND_PACKAGE(SDL2_ttf REQUIRED)
  196. IF(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$")
  197.     FIND_PACKAGE(OpenAL)
  198. ELSE(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$")
  199.     SET(OPENAL_FOUND "NO")
  200. ENDIF(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$")
  201. FIND_PACKAGE(ALUT)
  202.  
  203. FIND_PACKAGE(Boost 1.46.0 COMPONENTS program_options filesystem thread regex serialization REQUIRED)
  204. FIND_LIBRARY(BOOST_SYSTEM_LIBRARY NAMES boost_system)
  205.  
  206. IF(OPENC2E_USE_QT)
  207.     find_package(Qt4 REQUIRED)
  208. ENDIF(OPENC2E_USE_QT)
  209.  
  210. SET(USE_OPENAL "NO")
  211.  
  212. IF(OPENAL_FOUND)
  213.     IF(ALUT_FOUND)
  214.         SET(USE_OPENAL "YES")
  215.     ENDIF(ALUT_FOUND)
  216. ENDIF(OPENAL_FOUND)
  217.      
  218. IF(USE_OPENAL STREQUAL "NO")
  219.     IF (OPENC2E_USE_OPENAL MATCHES "^YES")
  220.         MESSAGE(FATAL_ERROR "OpenAL not found.")
  221.     ENDIF (OPENC2E_USE_OPENAL MATCHES "^YES")
  222.    
  223.     SET(ALUT_INCLUDE_DIR "")
  224.     SET(OPENAL_INCLUDE_DIR "")
  225.     SET(ALUT_LIBRARY "")
  226.     SET(OPENAL_LIBRARY "")
  227.     SET(OPENAL_SRC "")
  228.     SET(OPENAL_DEF "")
  229. ELSE(USE_OPENAL STREQUAL "NO")
  230.     SET(OPENAL_SRC "src/backends/OpenALBackend.cpp")
  231.     SET(OPENAL_DEF "-DOPENAL_SUPPORT")
  232. ENDIF(USE_OPENAL STREQUAL "NO")
  233.  
  234. IF(SDLMIXER_FOUND)
  235.     SET(SDLMIXER_SRC "src/backends/SDLMixerBackend.cpp")
  236.     SET(SDLMIXER_DEF "-DSDLMIXER_SUPPORT")
  237. ELSE(SDLMIXER_FOUND)
  238.     SET(SDLMIXER_INCLUDE_DIR "")
  239.     SET(SDLMIXER_LIBRARY "")
  240.     SET(SDLMIXER_SRC "")
  241.     SET(SDLMIXER_DEF "")
  242. ENDIF(SDLMIXER_FOUND)
  243.  
  244. IF(OPENC2E_USE_QT)
  245.     include(${QT_USE_FILE})
  246.     SET(SAVED_CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_BINARY_DIR)
  247.     SET(CMAKE_CURRENT_BINARY_DIR ${GEN})
  248.     QT4_WRAP_UI(OPENC2E_QT_UIS_H ${OPENC2E_QT_UIS})
  249.     QT4_WRAP_CPP(OPENC2E_QT_MOC_SRCS ${OPENC2E_QT_MOC_HDRS})
  250.     SET(CMAKE_CURRENT_BINARY_DIR SAVED_CMAKE_CURRENT_BINARY_DIR)
  251.     SET(QT_DEF "-DQT_SUPPORT")
  252. ENDIF(OPENC2E_USE_QT)
  253.  
  254. # Pass flags to the compiler
  255. ADD_DEFINITIONS("-W -Wall -Wno-conversion -Wno-unused -D_REENTRANT -DYYERROR_VERBOSE ${OPENAL_DEF} ${QT_DEF} ${SDLMIXER_DEF}")
  256.  
  257. IF(OPENC2E_USE_QT)
  258.     SET(FRONTEND_SRCS ${OPENC2E_SDL} ${OPENC2E_QT} ${OPENC2E_QT_UIS_H} ${OPENC2E_QT_MOC_SRCS})
  259.     SET(FRONTEND_LIBS ${QT_LIBRARIES})
  260. ELSE(OPENC2E_USE_QT)
  261.     SET(FRONTEND_SRCS ${OPENC2E_SDL})
  262.     SET(FRONTEND_LIBS)
  263. ENDIF(OPENC2E_USE_QT)
  264. ADD_EXECUTABLE(openc2e ${OPENC2E_CORE} ${FRONTEND_SRCS} ${OPENAL_SRC} ${SDLMIXER_SRC} ${SER_SRCS})
  265.  
  266. TARGET_LINK_LIBRARIES(openc2e z m pthread
  267.     ${SDL_LIBRARY}
  268.     ${SDLNET_LIBRARY}
  269.     ${SDLTTF_LIBRARY}
  270.     ${SDLGFX_LIBRARY}
  271.     ${SDLMIXER_LIBRARY}
  272.     ${OPENAL_LIBRARY}
  273.     ${ALUT_LIBRARY}
  274.     ${FRONTEND_LIBS}
  275.     boost_program_options
  276.     boost_serialization
  277.     boost_filesystem
  278.     boost_thread
  279.     boost_regex
  280.     )
  281. IF(BOOST_SYSTEM_LIBRARY)
  282. TARGET_LINK_LIBRARIES(openc2e boost_system)
  283. ENDIF(BOOST_SYSTEM_LIBRARY)
  284.  
  285. LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
  286.  
  287. INCLUDE_DIRECTORIES(BEFORE
  288.     ${GEN}
  289.     ${SRC}/src
  290.     ${SDL_INCLUDE_DIR}
  291.     ${SDLNET_INCLUDE_DIR}
  292.     ${SDLTTF_INCLUDE_DIR}
  293.     ${SDLGFX_INCLUDE_DIR}
  294.     ${SDLMIXER_INCLUDE_DIR}
  295.     ${OPENAL_INCLUDE_DIR}
  296.     ${ALUT_INCLUDE_DIR}
  297.     ${Boost_INCLUDE_DIR}
  298.     )
  299.  
  300. FILE(GLOB CAOSVM_FILES ${SRC}/src/caos/caosVM_*.cpp)
  301. ADD_CUSTOM_COMMAND(
  302.     OUTPUT ${GEN}/commandinfo.yml
  303.     COMMAND perl parsedocs.pl ${CAOSVM_FILES} > ${GEN}/commandinfo.yml
  304.     DEPENDS parsedocs.pl ${CAOSVM_FILES}
  305.     WORKING_DIRECTORY ${SRC})
  306.  
  307. ADD_CUSTOM_COMMAND(
  308.     OUTPUT ${BIN}/caosdocs.html
  309.     COMMAND perl docs/writehtml.pl ${GEN}/commandinfo.yml > ${BIN}/caosdocs.html
  310.     DEPENDS docs/writehtml.pl ${GEN}/commandinfo.yml
  311.     WORKING_DIRECTORY ${SRC})
  312. ADD_CUSTOM_COMMAND(
  313.     OUTPUT ${BIN}/docs.css
  314.     COMMAND cp docs/docs.css ${BIN}/docs.css
  315.     DEPENDS docs/docs.css
  316.     WORKING_DIRECTORY ${SRC})
  317. ADD_CUSTOM_COMMAND(
  318.     OUTPUT ${BIN}/openc2e.6
  319.     COMMAND pod2man --center="Openc2e Documentation" --section=6 ${SRC}/docs/openc2e.pod ${BIN}/openc2e.6
  320.     DEPENDS docs/openc2e.pod
  321.     )
  322. # it seems these ADD_CUSTOM_COMMANDS for flex and bison could be made
  323. # into a macro... e.g. FLEX(file1) FLEX(file2) etc...
  324. ADD_CUSTOM_COMMAND(
  325.     OUTPUT ${GEN}/cataloglexer.cpp
  326.     COMMAND re2c -o ${GEN}/cataloglexer.cpp ${SRC}/src/cataloglexer.re2c
  327.     DEPENDS ${SRC}/src/cataloglexer.re2c
  328.     WORKING_DIRECTORY ${SRC})
  329.  
  330. ADD_CUSTOM_COMMAND(
  331.     OUTPUT ${GEN}/catalogue.tab.cpp ${GEN}/catalogue.tab.hpp
  332.     COMMAND bison -d --name-prefix=cata --file-prefix="${GEN}/catalogue" src/catalogue.ypp
  333.     DEPENDS src/catalogue.ypp
  334.     WORKING_DIRECTORY ${SRC})
  335.  
  336. ADD_CUSTOM_COMMAND(
  337.     OUTPUT ${GEN}/cmddata.cpp
  338.     COMMAND perl writecmds.pl ${GEN}/commandinfo.yml > ${GEN}/cmddata.cpp
  339.     DEPENDS ${GEN}/commandinfo.yml writecmds.pl
  340.     WORKING_DIRECTORY ${SRC})
  341.  
  342. ADD_CUSTOM_COMMAND(
  343.     OUTPUT ${GEN}/caoslexer.cpp
  344.     COMMAND re2c -o ${GEN}/caoslexer.cpp ${SRC}/src/caoslexer.re2c
  345.     DEPENDS ${SRC}/src/caoslexer.re2c
  346.     WORKING_DIRECTORY ${SRC})
  347.  
  348. ADD_CUSTOM_COMMAND(
  349.     OUTPUT ${GEN}/mnglexer.cpp
  350.     COMMAND re2c -o ${GEN}/mnglexer.cpp ${SRC}/src/music/mnglexer.re2c
  351.     DEPENDS ${SRC}/src/music/mnglexer.re2c
  352.     WORKING_DIRECTORY ${SRC})
  353.  
  354. ADD_CUSTOM_COMMAND(
  355.     OUTPUT ${GEN}/mngparser.tab.cpp ${GEN}/mngparser.tab.hpp
  356.     COMMAND bison -d --name-prefix=mng --file-prefix="${GEN}/mngparser" src/music/mngparser.ypp
  357.     DEPENDS src/music/mngparser.ypp
  358.     WORKING_DIRECTORY ${SRC})
  359.  
  360. ADD_CUSTOM_TARGET(test DEPENDS openc2e
  361.     COMMAND perl ${SRC}/runtests.pl ${SRC}/tests)
  362. ADD_CUSTOM_TARGET(docs ALL DEPENDS ${BIN}/caosdocs.html ${BIN}/docs.css ${BIN}/openc2e.6)
  363. ADD_CUSTOM_TARGET(generated DEPENDS
  364.     ${GEN}/catalogue.tab.cpp ${GEN}/catalogue.tab.hpp
  365.     ${GEN}/caoslexer.cpp
  366.     ${GEN}/mngparser.tab.cpp ${GEN}/mngparser.tab.hpp
  367.     ${GEN}/mnglexer.cpp
  368.     ${GEN}/cataloglexer.cpp
  369.     ${GEN}/cmddata.cpp
  370. )
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top