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
"${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\"]'")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_main\", \"_resize_context\"]'")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\"]'")
#endif()
string(COMPARE EQUAL ${SOSC_BUILD_TARGET} CLIENT _CMP)
if(_CMP)
set(CMAKE_EXECUTABLE_SUFFIX ".html")
##################
## CLIENT BUILD ##
##################
## CLIENT BUILD ##
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#find_package(OpenGL REQUIRED)
#find_package(GLEW REQUIRED)
#find_package(SDL2 REQUIRED)
#find_package(SDL2_image REQUIRED)
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
"${CMAKE_CXX_FLAGS} -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"bmp\"]'")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_main\", \"_resize_context\"]'")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\"]'")
file(GLOB_RECURSE client_src
#"src/common/*.hpp"
#"src/common/*.cpp"
"src/client/*.hpp"
"src/client/*.cpp"
)
set(CMAKE_EXECUTABLE_SUFFIX ".html")
add_executable(client ${client_src})
file(GLOB_RECURSE client_src
#"src/common/*.hpp"
#"src/common/*.cpp"
"src/client/*.hpp"
"src/client/*.cpp"
)
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)
add_executable(client ${client_src})
## SERVER BUILD ##
target_include_directories(client
#PRIVATE ${PROJECT_SOURCE_DIR}/src/common
PRIVATE ${PROJECT_SOURCE_DIR}/src/client
PRIVATE ${PROJECT_SOURCE_DIR}/include/client)
#file(GLOB_RECURSE server_src
# "src/common/*.hpp"
# "src/common/*.cpp"
# "src/server/*.hpp"
# "src/server/*.cpp"
# "src/server/*.c"
# "src/server/*.h"
#)
install(TARGETS client RUNTIME DESTINATION bin/client)
else()
#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)
##################
## SERVER BUILD ##
##################
## COMMON LIBRARIES ##
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
#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()
file(GLOB_RECURSE server_src
"src/common/*.hpp"
"src/common/*.cpp"
"src/server/*.hpp"
"src/server/*.cpp"
"src/server/*.c"
"src/server/*.h"
)
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