feat: reorganize CMake configuration and add third-party library setup for Asio and EnTT
Signed-off-by: szdytom <szdytom@qq.com>
This commit is contained in:
parent
c13e67899b
commit
280aff5465
@ -1,9 +1,11 @@
|
|||||||
cmake_minimum_required(VERSION 3.27)
|
cmake_minimum_required(VERSION 3.27)
|
||||||
project(instructed LANGUAGES CXX)
|
project(instructed LANGUAGES CXX)
|
||||||
|
|
||||||
# Set C++ standard
|
# Optionally build examples
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
option(BUILD_EXAMPLES "Build example programs" ON)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
# Load third-party libraries
|
||||||
|
add_subdirectory(third_party)
|
||||||
|
|
||||||
# Add tilemap library and examples
|
# Add tilemap library and examples
|
||||||
add_subdirectory(tilemap)
|
add_subdirectory(tilemap)
|
||||||
|
11
third_party/CMakeLists.txt
vendored
Normal file
11
third_party/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.27)
|
||||||
|
|
||||||
|
set(ISTD_THIRD_PARTY_LIBS
|
||||||
|
entt
|
||||||
|
asio
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(lib IN LISTS ISTD_THIRD_PARTY_LIBS)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/${lib}.cmake)
|
||||||
|
endforeach()
|
||||||
|
|
12
third_party/asio.cmake
vendored
Normal file
12
third_party/asio.cmake
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.27)
|
||||||
|
cmake_policy(VERSION 3.27)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
message(STATUS "Downloading Asio(Standalone)...")
|
||||||
|
# Asio (Standalone) third-party library setup
|
||||||
|
FetchContent_Declare(
|
||||||
|
asio
|
||||||
|
URL "https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-34-2.zip"
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(asio)
|
||||||
|
message(STATUS "Asio ready")
|
12
third_party/entt.cmake
vendored
Normal file
12
third_party/entt.cmake
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.27)
|
||||||
|
cmake_policy(VERSION 3.27)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
# EnTT third-party library setup
|
||||||
|
message(STATUS "Downloading EnTT...")
|
||||||
|
FetchContent_Declare(
|
||||||
|
EnTT
|
||||||
|
URL "https://github.com/skypjack/entt/archive/refs/tags/v3.15.0.zip"
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(EnTT)
|
||||||
|
message(STATUS "EnTT ready")
|
@ -26,8 +26,6 @@ add_library(istd_tilemap ${ISTD_TILEMAP_SRC})
|
|||||||
target_compile_features(istd_tilemap PUBLIC cxx_std_23)
|
target_compile_features(istd_tilemap PUBLIC cxx_std_23)
|
||||||
target_include_directories(istd_tilemap PUBLIC include)
|
target_include_directories(istd_tilemap PUBLIC include)
|
||||||
|
|
||||||
# Optionally build examples
|
|
||||||
option(BUILD_EXAMPLES "Build example programs" ON)
|
|
||||||
if(BUILD_EXAMPLES)
|
if(BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user