2018-09-11 21:51:27 +00:00
|
|
|
cmake_minimum_required(VERSION 3.7)
|
2018-08-14 15:28:14 +00:00
|
|
|
project(sockscape)
|
|
|
|
|
2018-08-17 16:01:45 +00:00
|
|
|
string(COMPARE EQUAL ${CMAKE_BUILD_TYPE} Debug _CMP)
|
|
|
|
if(_CMP)
|
2018-08-30 21:38:58 +00:00
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
2018-08-17 16:01:45 +00:00
|
|
|
add_definitions("-DSOSC_DEBUG")
|
|
|
|
endif()
|
|
|
|
|
2018-08-14 15:28:14 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2018-09-11 21:51:27 +00:00
|
|
|
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
#if(CMAKE_COMPILER_IS_GNUCXX)
|
2018-09-13 22:11:09 +00:00
|
|
|
set(CMAKE_CXX_FLAGS
|
|
|
|
"${CMAKE_CXX_FLAGS} -std=c++11 -s USE_SDL=2")
|
|
|
|
set(CMAKE_CXX_FLAGS
|
|
|
|
"${CMAKE_CXX_FLAGS} --preload-file ../resources/client")
|
|
|
|
set(CMAKE_CXX_FLAGS
|
|
|
|
"${CMAKE_CXX_FLAGS} --shell-file ../src/client/shell.html")
|
|
|
|
set(CMAKE_CXX_FLAGS
|
|
|
|
"${CMAKE_CXX_FLAGS} -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"bmp\"]'")
|
2018-09-11 21:51:27 +00:00
|
|
|
#endif()
|
2018-08-14 15:28:14 +00:00
|
|
|
|
2018-09-13 22:11:09 +00:00
|
|
|
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
|
|
|
|
2018-08-14 21:44:37 +00:00
|
|
|
## CLIENT BUILD ##
|
|
|
|
|
2018-09-11 21:51:27 +00:00
|
|
|
#find_package(OpenGL REQUIRED)
|
|
|
|
#find_package(GLEW REQUIRED)
|
|
|
|
#find_package(SDL2 REQUIRED)
|
|
|
|
#find_package(SDL2_image REQUIRED)
|
2018-08-14 15:28:14 +00:00
|
|
|
|
2018-08-14 21:44:37 +00:00
|
|
|
file(GLOB_RECURSE client_src
|
2018-09-12 21:36:03 +00:00
|
|
|
#"src/common/*.hpp"
|
|
|
|
#"src/common/*.cpp"
|
2018-08-14 21:44:37 +00:00
|
|
|
"src/client/*.hpp"
|
|
|
|
"src/client/*.cpp"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(client ${client_src})
|
2018-09-11 21:51:27 +00:00
|
|
|
|
2018-08-14 21:44:37 +00:00
|
|
|
target_include_directories(client
|
2018-09-13 11:32:47 +00:00
|
|
|
#PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
2018-08-16 21:39:13 +00:00
|
|
|
PRIVATE ${PROJECT_SOURCE_DIR}/src/client
|
2018-09-11 21:51:27 +00:00
|
|
|
PRIVATE ${PROJECT_SOURCE_DIR}/include/client)
|
|
|
|
#PRIVATE ${OPENGL_INCLUDE_DIR}
|
|
|
|
#PRIVATE ${GLEW_INCLUDE_DIR}
|
|
|
|
#PRIVATE ${SDL2_INCLUDE_DIR}
|
|
|
|
#PRIVATE ${SDL2_IMAGE_INCLUDE_DIR})
|
|
|
|
#target_link_libraries(client
|
|
|
|
# ${OPENGL_LIBRARIES}
|
|
|
|
# ${GLEW_LIBRARY}
|
|
|
|
# ${SDL2_LIBRARY}
|
|
|
|
# ${SDL2_IMAGE_LIBRARIES})
|
2018-08-14 15:28:14 +00:00
|
|
|
install(TARGETS client RUNTIME DESTINATION bin/client)
|
|
|
|
|
2018-08-14 21:44:37 +00:00
|
|
|
## SERVER BUILD ##
|
|
|
|
|
2018-09-11 21:51:27 +00:00
|
|
|
#file(GLOB_RECURSE server_src
|
|
|
|
# "src/common/*.hpp"
|
|
|
|
# "src/common/*.cpp"
|
|
|
|
# "src/server/*.hpp"
|
|
|
|
# "src/server/*.cpp"
|
|
|
|
# "src/server/*.c"
|
|
|
|
# "src/server/*.h"
|
|
|
|
#)
|
2018-08-14 21:44:37 +00:00
|
|
|
|
2018-09-11 21:51:27 +00:00
|
|
|
#add_executable(server ${server_src})
|
|
|
|
#target_include_directories(server
|
|
|
|
# PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
|
|
|
# PRIVATE ${PROJECT_SOURCE_DIR}/src/server)
|
|
|
|
#install(TARGETS server RUNTIME DESTINATION bin/server)
|
2018-08-23 21:30:29 +00:00
|
|
|
|
|
|
|
## COMMON LIBRARIES ##
|
|
|
|
|
2018-09-11 21:51:27 +00:00
|
|
|
#if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
|
|
# target_link_libraries(server wsock32 ws2_32)
|
|
|
|
# target_link_libraries(client wsock32 ws2_32)
|
|
|
|
#elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
|
# target_link_libraries(server dl pthread nsl resolv)
|
|
|
|
# target_link_libraries(client dl pthread nsl resolv)
|
|
|
|
#else()
|
|
|
|
# target_link_libraries(server dl pthread socket nsl resolv)
|
|
|
|
# target_link_libraries(client dl pthread socket nsl resolv)
|
|
|
|
#endif()
|