OpenMiner/server/CMakeLists.txt

84 lines
3.6 KiB
CMake
Raw Normal View History

2020-02-14 18:36:45 +09:00
#------------------------------------------------------------------------------
# Set project name
#------------------------------------------------------------------------------
set(PROJECT_NAME ${PROJECT_NAME}_server)
#------------------------------------------------------------------------------
# Get source files
#------------------------------------------------------------------------------
2020-03-05 18:11:18 +01:00
file(GLOB_RECURSE SOURCE_FILES source/*/*.cpp ../external/*.cpp)
2020-02-29 03:17:28 +01:00
file(GLOB_RECURSE HEADER_FILES source/*.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_library(${PROJECT_NAME}_lib STATIC ${SOURCE_FILES})
add_executable(${PROJECT_NAME} source/main.cpp)
add_dependencies(${PROJECT_NAME}_lib ${CMAKE_PROJECT_NAME}_common)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_lib)
#------------------------------------------------------------------------------
# Compiler flags
#------------------------------------------------------------------------------
if (NOT MSVC)
target_compile_options(${PROJECT_NAME}_lib PRIVATE "$<$<CONFIG:DEBUG>:${DEBUG_GCC_FLAGS}>")
target_compile_options(${PROJECT_NAME}_lib PRIVATE "$<$<CONFIG:RELEASE>:${RELEASE_GCC_FLAGS}>")
target_compile_options(${PROJECT_NAME}_lib PRIVATE "$<$<CONFIG:RELWITHDEBINFO>:${RELWITHDEB_GCC_FLAGS}>")
2020-02-14 18:36:45 +09:00
target_compile_options(${PROJECT_NAME} PRIVATE "$<$<CONFIG:DEBUG>:${DEBUG_GCC_FLAGS}>")
target_compile_options(${PROJECT_NAME} PRIVATE "$<$<CONFIG:RELEASE>:${RELEASE_GCC_FLAGS}>")
target_compile_options(${PROJECT_NAME} PRIVATE "$<$<CONFIG:RELWITHDEBINFO>:${RELWITHDEB_GCC_FLAGS}>")
endif ()
target_compile_options(${PROJECT_NAME}_lib PRIVATE -DDEBUG_ENABLED)
target_compile_options(${PROJECT_NAME}_lib PRIVATE -DGLM_FORCE_RADIANS)
target_compile_options(${PROJECT_NAME}_lib PRIVATE -DSOL_CHECK_ARGUMENTS -DSOL_PRINT_ERRORS=0)
2020-02-14 18:36:45 +09:00
target_compile_options(${PROJECT_NAME} PRIVATE -DDEBUG_ENABLED)
target_compile_options(${PROJECT_NAME} PRIVATE -DGLM_FORCE_RADIANS)
target_compile_options(${PROJECT_NAME} PRIVATE -DSOL_CHECK_ARGUMENTS -DSOL_PRINT_ERRORS=0)
if(MINGW)
target_link_options(${PROJECT_NAME}_lib PRIVATE -static-libstdc++ -static-libgcc -mconsole)
2020-02-14 18:36:45 +09:00
target_link_options(${PROJECT_NAME} PRIVATE -static-libstdc++ -static-libgcc -mconsole)
2020-01-23 14:27:31 +09:00
endif()
# target_compile_options(${PROJECT_NAME}_lib PRIVATE -pg)
2020-02-14 18:36:45 +09:00
# target_compile_options(${PROJECT_NAME} PRIVATE -pg)
# target_link_options(${PROJECT_NAME}_lib PRIVATE -pg)
2020-02-14 18:36:45 +09:00
# target_link_options(${PROJECT_NAME} PRIVATE -pg)
#------------------------------------------------------------------------------
# Link options
#------------------------------------------------------------------------------
if (UNIX)
set (UNIX_LIBS -ldl)
endif ()
2020-03-05 18:11:18 +01:00
target_link_libraries(${PROJECT_NAME}_lib sfml-system sfml-network)
2020-02-14 18:36:45 +09:00
target_link_libraries(${PROJECT_NAME}
${PROJECT_NAME}_lib
${GAMEKIT_LIBRARIES}
${OPENGL_LIBRARIES}
${SDL2_LIBRARIES}
${SDL2_IMAGE_LIBRARIES}
${SDL2_MIXER_LIBRARIES}
${SDL2_TTF_LIBRARIES}
${TINYXML2_LIBRARIES}
2020-01-23 14:27:31 +09:00
${GLEW_LIBRARIES}
${LUA_LIBRARIES}
sfml-system
sfml-network
${UNIX_LIBS}
${CMAKE_PROJECT_NAME}_common
stdc++fs)