cmake: reorganize project structure
parent
d744f37ac4
commit
52d61551a9
|
@ -1,5 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
project(eco2d)
|
||||
include(cmake/utils.cmake)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
|
||||
|
@ -11,5 +12,8 @@ include_directories(eco2d-cli code/vendors code/common)
|
|||
include_directories(eco2d-client code/vendors code/common)
|
||||
include_directories(eco2d-server code/vendors code/vendors/flecs code/common)
|
||||
|
||||
add_subdirectory(code/common)
|
||||
add_subdirectory(code/vendors)
|
||||
|
||||
add_subdirectory(code/apps/client)
|
||||
add_subdirectory(code/apps/server)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
function(link_system_libs target_name)
|
||||
if (WIN32)
|
||||
target_link_libraries(${target_name} winmm)
|
||||
elseif (APPLE)
|
||||
target_link_libraries(${target_name} pthread m dl)
|
||||
elseif (UNIX)
|
||||
target_link_libraries(${target_name} pthread m dl atomic)
|
||||
endif()
|
||||
endfunction()
|
|
@ -25,14 +25,7 @@ add_library(client-common STATIC
|
|||
source/main.c
|
||||
|
||||
header/network.h
|
||||
header/platform.h
|
||||
header/game.h
|
||||
|
||||
../../common/signal_handling.c
|
||||
../../common/signal_handling.h
|
||||
|
||||
../../common/assets.h
|
||||
../../common/assets.c
|
||||
)
|
||||
|
||||
add_executable(eco2d-client
|
||||
|
@ -43,17 +36,11 @@ add_executable(eco2d-cli
|
|||
source/platform_text.c
|
||||
)
|
||||
|
||||
include_directories(header/)
|
||||
target_link_libraries(eco2d-client raylib client-common)
|
||||
target_link_libraries(eco2d-cli client-common)
|
||||
set(LIBS client-common cwpack eco2d-common)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(eco2d-cli winmm)
|
||||
target_link_libraries(eco2d-client winmm)
|
||||
elseif (APPLE)
|
||||
target_link_libraries(eco2d-cli pthread m dl)
|
||||
target_link_libraries(eco2d-client pthread m dl)
|
||||
elseif (UNIX)
|
||||
target_link_libraries(eco2d-cli pthread m dl atomic)
|
||||
target_link_libraries(eco2d-client pthread m dl atomic)
|
||||
endif()
|
||||
include_directories(header/)
|
||||
target_link_libraries(eco2d-client raylib ${LIBS})
|
||||
target_link_libraries(eco2d-cli ${LIBS})
|
||||
|
||||
link_system_libs(eco2d-cli)
|
||||
link_system_libs(eco2d-client)
|
||||
|
|
|
@ -18,44 +18,8 @@ add_executable(eco2d-server
|
|||
header/components/physics.h
|
||||
header/components/general.h
|
||||
header/components/controllers.h
|
||||
|
||||
../../common/signal_handling.c
|
||||
../../common/signal_handling.h
|
||||
|
||||
../../common/assets.h
|
||||
../../common/assets.c
|
||||
|
||||
../../vendors/cwpack/cwpack.c
|
||||
../../vendors/cwpack/cwpack.h
|
||||
|
||||
../../vendors/flecs/flecs.c
|
||||
../../vendors/flecs/flecs.h
|
||||
../../vendors/flecs/flecs_meta.c
|
||||
../../vendors/flecs/flecs_meta.h
|
||||
../../vendors/flecs/flecs_json.h
|
||||
../../vendors/flecs/flecs_json.c
|
||||
../../vendors/flecs/flecs_rest.h
|
||||
../../vendors/flecs/flecs_rest.c
|
||||
../../vendors/flecs/flecs_monitor.h
|
||||
../../vendors/flecs/flecs_monitor.c
|
||||
../../vendors/flecs/flecs_player.h
|
||||
../../vendors/flecs/flecs_player.c
|
||||
../../vendors/flecs/flecs_dash.h
|
||||
../../vendors/flecs/flecs_dash.c
|
||||
../../vendors/flecs/flecs_components_http.h
|
||||
../../vendors/flecs/flecs_components_http.c
|
||||
../../vendors/flecs/flecs_systems_civetweb.h
|
||||
../../vendors/flecs/flecs_systems_civetweb.c
|
||||
../../vendors/flecs/flecs_os_api_posix.h
|
||||
../../vendors/flecs/flecs_os_api_posix.c
|
||||
)
|
||||
|
||||
include_directories(eco2d-server header)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(eco2d-server winmm)
|
||||
elseif (APPLE)
|
||||
target_link_libraries(eco2d-server pthread m dl)
|
||||
elseif (UNIX)
|
||||
target_link_libraries(eco2d-server pthread m dl atomic)
|
||||
endif()
|
||||
target_link_libraries(eco2d-server eco2d-common flecs-bundle cwpack)
|
||||
link_system_libs(eco2d-server)
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
file(GLOB_RECURSE SRCS *.h *.c)
|
||||
add_library(eco2d-common STATIC ${SRCS})
|
|
@ -0,0 +1,2 @@
|
|||
add_subdirectory(flecs)
|
||||
add_subdirectory(cwpack)
|
|
@ -0,0 +1,2 @@
|
|||
file(GLOB SRCS *.h *.c)
|
||||
add_library(cwpack STATIC ${SRCS})
|
|
@ -0,0 +1,2 @@
|
|||
file(GLOB SRCS *.c *.h)
|
||||
add_library(flecs-bundle STATIC ${SRCS})
|
Loading…
Reference in New Issue