Guest User

Untitled

a guest
Aug 12th, 2019
337
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cmake_minimum_required(VERSION 3.14)
  2. project(FantasyRPG)
  3.  
  4. set(CMAKE_CXX_STANDARD 17)
  5.  
  6. if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
  7.     add_compile_definitions(RELEASE)
  8. endif ()
  9.  
  10. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${OS}-${CMAKE_BUILD_TYPE})
  11.  
  12. if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  13.     execute_process(COMMAND touch ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug.txt)
  14.     file(WRITE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/content.txt ../../content/)
  15. endif ()
  16.  
  17. include_directories(
  18.         include
  19.         misc
  20. )
  21.  
  22. set(SOURCES files)
  23.  
  24. set(WINSOURCES files)
  25.  
  26. set(NIXSOURCES files)
  27.  
  28. set(WASMSOURCES files)
  29.  
  30. if (${OS} STREQUAL WASM)
  31.     add_compile_definitions(WASM)
  32.     add_link_options(-static-libgcc -static-libstdc++ --bind "SHELL:-s USE_GLFW=3" "SHELL:-s WASM=1" --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/content@/ --use-preload-plugins)
  33.     add_compile_options()
  34.     if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
  35.         add_link_options(-O3)
  36.         add_compile_options(-O3)
  37.     else ()
  38.         set(CMAKE_EXECUTABLE_SUFFIX ".html")
  39.         add_compile_options(--js-opts 0 "SHELL:-s ASSERTIONS=1" --emrun --profiling "SHELL:-s DEMANGLE_SUPPORT=1" -g4 --source-map-base http://localhost:8080/)
  40.         add_link_options(--js-opts 0 "SHELL:-s ASSERTIONS=1" --emrun -g4 "SHELL:-s DEMANGLE_SUPPORT=1" --source-map-base http://localhost:8080/)
  41.     endif ()
  42.     add_executable(FantasyRPG ${SOURCES} ${WASMSOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib.bc)
  43.     target_link_libraries(FantasyRPG ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib.bc)
  44. endif ()
  45.  
  46. if (${OS} STREQUAL Windows)
  47.     add_link_options(-static-libgcc -static-libstdc++ -static -lwinpthread)
  48.     add_compile_definitions(WINDOWS)
  49.     add_executable(FantasyRPG.exe ${WINSOURCES} ${SOURCES})
  50.  
  51.     target_link_libraries(FantasyRPG.exe
  52.             ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib64.dll)
  53. endif ()
  54. if (${OS} STREQUAL Linux)
  55.     add_link_options(-static-libgcc -static-libstdc++)
  56.     add_compile_definitions(LINUX)
  57.     add_executable(FantasyRPG ${NIXSOURCES} ${SOURCES})
  58.     target_link_libraries(FantasyRPG
  59.             ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib64.so
  60.             libpthread.so.0)
  61. endif ()
RAW Paste Data