2019-01-09 19:32:28 +01:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Get source files
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
file(GLOB_RECURSE SOURCE_FILES source/*.cpp)
|
|
|
|
file(GLOB_RECURSE HEADER_FILES include/*.hpp ../common/*.hpp ../external/*.hpp)
|
|
|
|
|
|
|
|
foreach(HEADER_FILE ${HEADER_FILES})
|
|
|
|
get_filename_component(HEADER_DIRECTORY ${HEADER_FILE} DIRECTORY)
|
|
|
|
include_directories(${HEADER_DIRECTORY})
|
|
|
|
endforeach(HEADER_FILE)
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Add executables
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES})
|
|
|
|
add_dependencies(${CMAKE_PROJECT_NAME} ${CMAKE_PROJECT_NAME}_common)
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Compiler flags
|
|
|
|
#------------------------------------------------------------------------------
|
2020-01-22 14:18:31 +09:00
|
|
|
if (NOT MSVC)
|
|
|
|
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -O3 -ffast-math)
|
|
|
|
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -g -Wall -Wextra -Wfatal-errors -Wno-variadic-macros)
|
|
|
|
endif ()
|
|
|
|
|
2019-01-09 19:32:28 +01:00
|
|
|
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -DDEBUG_ENABLED)
|
2019-01-20 01:31:44 +01:00
|
|
|
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -DGLM_FORCE_RADIANS)
|
2019-01-09 19:32:28 +01:00
|
|
|
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -DSOL_CHECK_ARGUMENTS
|
|
|
|
# -DSOL_SAFE_USERTYPE=1
|
|
|
|
# -DSOL_SAFE_REFERENCES=1
|
|
|
|
# -DSOL_SAFE_FUNCTION_CALLS=1
|
|
|
|
# -DSOL_SAFE_FUNCTION=1
|
|
|
|
# -DSOL_SAFE_NUMERICS=1
|
|
|
|
# -DSOL_SAFE_GETTER=1
|
2019-01-12 19:14:59 +01:00
|
|
|
-DSOL_PRINT_ERRORS=1
|
2019-01-09 19:32:28 +01:00
|
|
|
)
|
|
|
|
|
2020-01-23 01:49:57 +09:00
|
|
|
if(MINGW)
|
2020-01-23 13:18:09 +09:00
|
|
|
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE -static-libstdc++ -static-libgcc -mconsole)
|
2020-01-23 01:49:57 +09:00
|
|
|
endif()
|
2020-01-22 14:18:31 +09:00
|
|
|
|
2020-01-23 14:27:31 +09:00
|
|
|
if(MSVC)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
else()
|
|
|
|
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -std=c++14)
|
|
|
|
endif()
|
2019-01-09 19:32:28 +01:00
|
|
|
|
2019-01-20 00:54:58 +01:00
|
|
|
# target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -pg)
|
|
|
|
# target_link_options(${CMAKE_PROJECT_NAME} PRIVATE -pg)
|
2019-01-13 16:38:30 +01:00
|
|
|
|
2019-01-09 19:32:28 +01:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Link options
|
|
|
|
#------------------------------------------------------------------------------
|
2020-01-22 22:25:50 +09:00
|
|
|
if (UNIX)
|
|
|
|
set (UNIX_LIBS -ldl)
|
|
|
|
endif ()
|
|
|
|
|
2019-01-09 19:32:28 +01:00
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME}
|
2020-01-23 01:49:57 +09:00
|
|
|
${GAMEKIT_LIBRARIES}
|
2019-01-09 19:32:28 +01:00
|
|
|
${OPENGL_LIBRARIES}
|
|
|
|
${SDL2_LIBRARIES}
|
2020-01-22 14:18:31 +09:00
|
|
|
${SDL2_IMAGE_LIBRARIES}
|
|
|
|
${SDL2_MIXER_LIBRARIES}
|
|
|
|
${SDL2_TTF_LIBRARIES}
|
2019-01-09 19:32:28 +01:00
|
|
|
${TINYXML2_LIBRARIES}
|
2020-01-22 22:25:50 +09:00
|
|
|
${GLEW_LIBRARIES}
|
2019-01-09 19:32:28 +01:00
|
|
|
${LUA_LIBRARIES}
|
2019-01-25 23:47:45 +01:00
|
|
|
sfml-system
|
2020-01-22 22:25:50 +09:00
|
|
|
sfml-network
|
2020-01-23 01:49:57 +09:00
|
|
|
${UNIX_LIBS}
|
2019-01-09 19:32:28 +01:00
|
|
|
${CMAKE_PROJECT_NAME}_common)
|
|
|
|
|