diff --git a/CMakeLists.txt b/CMakeLists.txt index 346667f..352e30c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ cmake_minimum_required(VERSION 3.27) project(instructed LANGUAGES CXX) -# Set C++ standard -set(CMAKE_CXX_STANDARD 23) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Optionally build examples +option(BUILD_EXAMPLES "Build example programs" ON) + +# Load third-party libraries +add_subdirectory(third_party) # Add tilemap library and examples add_subdirectory(tilemap) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 0000000..b80d958 --- /dev/null +++ b/third_party/CMakeLists.txt @@ -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() + diff --git a/third_party/asio.cmake b/third_party/asio.cmake new file mode 100644 index 0000000..96f09cf --- /dev/null +++ b/third_party/asio.cmake @@ -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") diff --git a/third_party/entt.cmake b/third_party/entt.cmake new file mode 100644 index 0000000..a4ac691 --- /dev/null +++ b/third_party/entt.cmake @@ -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") diff --git a/tilemap/CMakeLists.txt b/tilemap/CMakeLists.txt index 04f7e6b..fcb75d4 100644 --- a/tilemap/CMakeLists.txt +++ b/tilemap/CMakeLists.txt @@ -26,8 +26,6 @@ add_library(istd_tilemap ${ISTD_TILEMAP_SRC}) target_compile_features(istd_tilemap PUBLIC cxx_std_23) target_include_directories(istd_tilemap PUBLIC include) -# Optionally build examples -option(BUILD_EXAMPLES "Build example programs" ON) if(BUILD_EXAMPLES) add_subdirectory(examples) endif()