COSC-3P98-Final-Project/CMakeLists.txt

61 lines
2.2 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.0)
# emscriptem
cmake_policy(SET CMP0015 NEW)
project(FinalProject)
option(USE_EXTRAS "Use the extra stuff I've added to this project! (Basically emscriptem)" OFF)
2023-01-16 12:48:42 -05:00
set(CMAKE_CXX_STANDARD 17)
if (USE_EXTRAS)
message("Using emscriptem linker and compile flags!")
2023-02-15 00:49:27 -05:00
#add_definitions("-std=c++17")
set(CMAKE_VERBOSE_MAKEFILE on)
else()
# used to debug memory related issues
if ((CMAKE_BUILD_TYPE MATCHES Debug))
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif ()
message("Building for Debug")
else ()
message("Building for Release")
endif ()
2023-02-08 13:42:39 -05:00
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(libraries/glfw-3.3.8)
endif()
2023-03-06 00:33:43 -05:00
include_directories(libraries/sparsepp/sparsepp)
include_directories(libraries/parallel-hashmap/parallel_hashmap)
2023-01-16 13:51:51 -05:00
# My Stuff
2023-01-16 12:48:42 -05:00
file(GLOB_RECURSE CPP_FILES "src/*.cpp")
include_directories(include/)
2023-01-16 13:51:51 -05:00
add_subdirectory(libraries/BLT)
2023-02-15 00:49:27 -05:00
add_subdirectory(libraries/freetype-2.13.0)
2023-01-16 13:51:51 -05:00
add_executable(FinalProject ${CPP_FILES})
target_link_libraries(FinalProject PRIVATE BLT)
2023-02-15 00:49:27 -05:00
target_link_libraries(FinalProject PRIVATE freetype)
2023-01-16 13:51:51 -05:00
2023-02-17 10:55:21 -05:00
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
if (USE_EXTRAS)
#set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-s DEMANGLE_SUPPORT=1 --preload-file ${CMAKE_SOURCE_DIR}/assets --bind")
#set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-s DEMANGLE_SUPPORT=1 --preload-file 'assets' --bind")
2023-03-06 23:39:25 -05:00
set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -sASSERTIONS=1 -pthread -sPTHREAD_POOL_SIZE=8 -s INITIAL_MEMORY=134217728 -sUSE_GLFW=3 --preload-file 'assets'")
2023-02-08 23:23:42 -05:00
# these flags will be set by cmake automatically based on build type
#set_target_properties(FinalProject PROPERTIES COMPILE_FLAGS "-O3")
2023-03-06 23:39:25 -05:00
set_target_properties(FinalProject PROPERTIES COMPILE_FLAGS "-pthread")
2023-02-08 13:42:39 -05:00
else()
target_link_libraries(FinalProject PRIVATE glfw)
endif()