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,13 +7,18 @@ if(_CMP)
add_definitions("-DSOSC_DEBUG") add_definitions("-DSOSC_DEBUG")
endif() endif()
string(COMPARE EQUAL ${SOSC_BUILD_TARGET} CLIENT _CMP)
if(_CMP)
##################
## CLIENT BUILD ##
##################
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++11 -s USE_SDL=2") "${CMAKE_CXX_FLAGS} -s USE_SDL=2 --preload-file ../resources/client")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} --preload-file ../resources/client")
set(CMAKE_CXX_FLAGS set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} --shell-file ../src/client/shell.html") "${CMAKE_CXX_FLAGS} --shell-file ../src/client/shell.html")
set(CMAKE_CXX_FLAGS set(CMAKE_CXX_FLAGS
@ -22,17 +27,9 @@ set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_main\", \"_resize_context\"]'") "${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\"]'") "${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/*.hpp"
#"src/common/*.cpp" #"src/common/*.cpp"
@ -46,43 +43,39 @@ target_include_directories(client
#PRIVATE ${PROJECT_SOURCE_DIR}/src/common #PRIVATE ${PROJECT_SOURCE_DIR}/src/common
PRIVATE ${PROJECT_SOURCE_DIR}/src/client PRIVATE ${PROJECT_SOURCE_DIR}/src/client
PRIVATE ${PROJECT_SOURCE_DIR}/include/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) install(TARGETS client RUNTIME DESTINATION bin/client)
else()
##################
## SERVER BUILD ## ## SERVER BUILD ##
##################
#file(GLOB_RECURSE server_src if(CMAKE_COMPILER_IS_GNUCXX)
# "src/common/*.hpp" set(CMAKE_CXX_STANDARD 11)
# "src/common/*.cpp" set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# "src/server/*.hpp" endif()
# "src/server/*.cpp"
# "src/server/*.c"
# "src/server/*.h"
#)
#add_executable(server ${server_src}) file(GLOB_RECURSE server_src
#target_include_directories(server "src/common/*.hpp"
# PRIVATE ${PROJECT_SOURCE_DIR}/src/common "src/common/*.cpp"
# PRIVATE ${PROJECT_SOURCE_DIR}/src/server) "src/server/*.hpp"
#install(TARGETS server RUNTIME DESTINATION bin/server) "src/server/*.cpp"
"src/server/*.c"
"src/server/*.h"
)
## COMMON LIBRARIES ## 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") if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# target_link_libraries(server wsock32 ws2_32) target_link_libraries(server wsock32 ws2_32)
# target_link_libraries(client wsock32 ws2_32) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
#elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") target_link_libraries(server dl pthread nsl resolv)
# target_link_libraries(server dl pthread nsl resolv) else()
# target_link_libraries(client dl pthread nsl resolv) target_link_libraries(server dl pthread socket nsl resolv)
#else() endif()
# target_link_libraries(server dl pthread socket nsl resolv) endif()
# target_link_libraries(client dl pthread socket nsl resolv)
#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