Merge pull request 'build: rework cmake static and shared library building' (#1) from refactor/dll-support into master
Reviewed-on: http://localhost:3001/illyum/IsoEngine/pulls/1
This commit is contained in:
commit
54e4b00f8c
@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.24)
|
||||
|
||||
project(IsoEngine LANGUAGES CXX)
|
||||
|
||||
# Options for shared/static libraries, testbeds, and sandbox
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs) instead of static libraries" OFF)
|
||||
option(BUILD_CLIENT "Build the client testbed executable" ON)
|
||||
option(BUILD_SANDBOX "Build sandbox client and server" ON)
|
||||
# Options for shared/static libraries, and client/server examples
|
||||
option(BUILD_SHARED_LIBS "Build engine library dependencies as shared (DLLs)" OFF)
|
||||
option(BUILD_CLIENT "Build the client example" ON)
|
||||
option(BUILD_SERVER "Build the server example" ON)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "No build type specified, defaulting to Debug")
|
||||
@ -29,14 +29,16 @@ endif()
|
||||
set(FETCHCONTENT_QUIET OFF)
|
||||
include(FetchContent)
|
||||
|
||||
# ENet is header-only, provide include directory
|
||||
# enet is header-only
|
||||
set(ENET_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/thirdparty/enet")
|
||||
|
||||
# Fetch Raylib and other dependencies
|
||||
FetchContent_Declare(
|
||||
raylib
|
||||
URL https://github.com/raysan5/raylib/archive/refs/tags/5.0.zip
|
||||
)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(RAYLIB_LIBTYPE SHARED)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(raylib)
|
||||
|
||||
FetchContent_Declare(
|
||||
@ -82,17 +84,15 @@ FetchContent_Declare(
|
||||
GIT_REPOSITORY https://github.com/icculus/physfs.git
|
||||
GIT_TAG release-3.2.0
|
||||
)
|
||||
FetchContent_MakeAvailable(physfs)
|
||||
|
||||
# PhysFS settings
|
||||
# PhysFS settings (default: static)
|
||||
set(PHYSFS_BUILD_STATIC ON CACHE BOOL "Build PhysFS static library" FORCE)
|
||||
set(PHYSFS_BUILD_SHARED OFF CACHE BOOL "Do not build PhysFS shared library" FORCE)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(PHYSFS_BUILD_SHARED ON CACHE BOOL "Build PhysFS shared library" FORCE)
|
||||
set(PHYSFS_BUILD_STATIC OFF CACHE BOOL "Do not build PhysFS static library" FORCE)
|
||||
else()
|
||||
set(PHYSFS_BUILD_STATIC ON CACHE BOOL "Build PhysFS static library" FORCE)
|
||||
set(PHYSFS_BUILD_SHARED OFF CACHE BOOL "Do not build PhysFS shared library" FORCE)
|
||||
endif()
|
||||
set(PHYSFS_BUILD_TEST OFF CACHE BOOL "Disable PhysFS test program" FORCE)
|
||||
FetchContent_MakeAvailable(physfs)
|
||||
|
||||
# Main Engine Library
|
||||
set(ENGINE_SOURCES
|
||||
@ -141,7 +141,7 @@ target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_D
|
||||
target_link_libraries(rlImGui PRIVATE raylib ImGui)
|
||||
target_link_libraries(IsoEngine PRIVATE ImGui rlImGui)
|
||||
|
||||
# Testbed and Sandbox executables (client/server)
|
||||
# Example executables (client/server)
|
||||
if(BUILD_CLIENT OR BUILD_SANDBOX)
|
||||
# Client executable
|
||||
set(CLIENT_SOURCE "${CMAKE_CURRENT_LIST_DIR}/sandbox/client.cpp")
|
||||
|
Loading…
x
Reference in New Issue
Block a user