multitoolchain drifting

This commit is contained in:
Alec Obradovich 2018-09-17 14:29:56 -05:00 committed by malloc
parent f722ee0cf6
commit 6c20ba38d9
3 changed files with 75 additions and 68 deletions

View file

@ -7,82 +7,75 @@ if(_CMP)
add_definitions("-DSOSC_DEBUG")
endif()
set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
#if(CMAKE_COMPILER_IS_GNUCXX)
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
string(COMPARE EQUAL ${SOSC_BUILD_TARGET} CLIENT _CMP)
if(_CMP)
##################
## CLIENT BUILD ##
##################
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s USE_SDL=2 --preload-file ../resources/client")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} --shell-file ../src/client/shell.html")
set(CMAKE_CXX_FLAGS
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"bmp\"]'")
set(CMAKE_CXX_FLAGS
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_main\", \"_resize_context\"]'")
set(CMAKE_CXX_FLAGS
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\"]'")
#endif()
set(CMAKE_EXECUTABLE_SUFFIX ".html")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
## CLIENT BUILD ##
#find_package(OpenGL REQUIRED)
#find_package(GLEW REQUIRED)
#find_package(SDL2 REQUIRED)
#find_package(SDL2_image REQUIRED)
file(GLOB_RECURSE client_src
file(GLOB_RECURSE client_src
#"src/common/*.hpp"
#"src/common/*.cpp"
"src/client/*.hpp"
"src/client/*.cpp"
)
)
add_executable(client ${client_src})
add_executable(client ${client_src})
target_include_directories(client
target_include_directories(client
#PRIVATE ${PROJECT_SOURCE_DIR}/src/common
PRIVATE ${PROJECT_SOURCE_DIR}/src/client
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})
install(TARGETS client RUNTIME DESTINATION bin/client)
## SERVER BUILD ##
install(TARGETS client RUNTIME DESTINATION bin/client)
else()
#file(GLOB_RECURSE server_src
# "src/common/*.hpp"
# "src/common/*.cpp"
# "src/server/*.hpp"
# "src/server/*.cpp"
# "src/server/*.c"
# "src/server/*.h"
#)
##################
## SERVER BUILD ##
##################
#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)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
## COMMON LIBRARIES ##
file(GLOB_RECURSE server_src
"src/common/*.hpp"
"src/common/*.cpp"
"src/server/*.hpp"
"src/server/*.cpp"
"src/server/*.c"
"src/server/*.h"
)
#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()
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)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(server wsock32 ws2_32)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(server dl pthread nsl resolv)
else()
target_link_libraries(server dl pthread socket nsl resolv)
endif()
endif()

14
src/web/index.html Normal file
View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>client</title>
<style type="text/css">
</style>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
</body>
</html>

0
src/web/script.js Normal file
View file