Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmake_minimum_required(VERSION 3.14)
- project(FantasyRPG)
- set(CMAKE_CXX_STANDARD 17)
- if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
- add_compile_definitions(RELEASE)
- endif ()
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${OS}-${CMAKE_BUILD_TYPE})
- if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
- execute_process(COMMAND touch ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug.txt)
- file(WRITE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/content.txt ../../content/)
- endif ()
- include_directories(
- include
- misc
- )
- set(SOURCES files)
- set(WINSOURCES files)
- set(NIXSOURCES files)
- set(WASMSOURCES files)
- if (${OS} STREQUAL WASM)
- add_compile_definitions(WASM)
- 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)
- add_compile_options()
- if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
- add_link_options(-O3)
- add_compile_options(-O3)
- else ()
- set(CMAKE_EXECUTABLE_SUFFIX ".html")
- add_compile_options(--js-opts 0 "SHELL:-s ASSERTIONS=1" --emrun --profiling "SHELL:-s DEMANGLE_SUPPORT=1" -g4 --source-map-base http://localhost:8080/)
- add_link_options(--js-opts 0 "SHELL:-s ASSERTIONS=1" --emrun -g4 "SHELL:-s DEMANGLE_SUPPORT=1" --source-map-base http://localhost:8080/)
- endif ()
- add_executable(FantasyRPG ${SOURCES} ${WASMSOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib.bc)
- target_link_libraries(FantasyRPG ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib.bc)
- endif ()
- if (${OS} STREQUAL Windows)
- add_link_options(-static-libgcc -static-libstdc++ -static -lwinpthread)
- add_compile_definitions(WINDOWS)
- add_executable(FantasyRPG.exe ${WINSOURCES} ${SOURCES})
- target_link_libraries(FantasyRPG.exe
- ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib64.dll)
- endif ()
- if (${OS} STREQUAL Linux)
- add_link_options(-static-libgcc -static-libstdc++)
- add_compile_definitions(LINUX)
- add_executable(FantasyRPG ${NIXSOURCES} ${SOURCES})
- target_link_libraries(FantasyRPG
- ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraylib64.so
- libpthread.so.0)
- endif ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement