Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 4.0)

file(STRINGS "version.txt" MORPHEUS_VERSION)

Expand All @@ -16,7 +16,6 @@ cmake_policy(SET CMP0127 NEW)
cmake_policy(SET CMP0135 NEW)
cmake_policy(SET CMP0140 NEW)


#------------------------------------------------------------------------------------------------------------------------------------------
# Standard CMake Includes
include(CTest)
Expand All @@ -25,22 +24,6 @@ include(GNUInstallDirs)
include(CMakeDependentOption)
include(CMakePackageConfigHelpers)

if(WIN32)
option(MORPHEUS_RENDER_SYSTEM_DIRECT_X12 "Build with support for the Dirext X 12 render system" ON)
endif(WIN32)

if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
option(MORPHEUS_RENDER_SYSTEM_METAL "Build with support for the Metal render system" ON)
endif(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")

option(MORPHEUS_RENDER_SYSTEM_OPENGL "Build with support for the Open GL render system" ON)
option(MORPHEUS_RENDER_SYSTEM_VULKAN "Build with support for the Vulkan render system" ON)
cmake_dependent_option(MORPHEUS_LINK_WITH_MOLD "Enable the mold linker" ON "LINUX" OFF)
cmake_dependent_option(MORPHEUS_CODE_COVERAGE "Enable code coverage" ON "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"GNU\"" OFF)
cmake_dependent_option(MORPHEUS_INCLUDE_NATVIS "Enable inclusion of a natvis files for debugging" ON "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"MSVC\"" OFF)

set(BUILD_SHARED_LIBS NO)

# Include necessary submodules
list(APPEND CMAKE_MODULE_PATH
${CMAKE_BINARY_DIR}
Expand All @@ -55,6 +38,7 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/generat
# Custom CMake Includes
include(coverage)
include(compiler)
include(third_party)
include(conformance)
include(documentation)
include(IDESettings)
Expand All @@ -64,7 +48,31 @@ include(morpheus_add_library)
include(morpheus_add_testing_library)
include(morpheus_add_tests)
include(sanitisers)
include(third_party)

set(BUILD_SHARED_LIBS NO)

morpheus_conformance_check(
RESULT MODULES_SUPPORTED
MSVC_VERSION "19.34"
GNU_VERSION "14"
CLANG_VERSION "17"
)

if(WIN32)
option(MORPHEUS_RENDER_SYSTEM_DIRECT_X12 "Build with support for the Dirext X 12 render system" ON)
endif(WIN32)

if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
option(MORPHEUS_RENDER_SYSTEM_METAL "Build with support for the Metal render system" ON)
endif(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")

option(MORPHEUS_RENDER_SYSTEM_OPENGL "Build with support for the Open GL render system" ON)
option(MORPHEUS_RENDER_SYSTEM_VULKAN "Build with support for the Vulkan render system" ON)
cmake_dependent_option(MORPHEUS_LINK_WITH_MOLD "Enable the mold linker" ON "LINUX" OFF)
cmake_dependent_option(MORPHEUS_CODE_COVERAGE "Enable code coverage" ON "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"GNU\"" OFF)
cmake_dependent_option(MORPHEUS_INCLUDE_NATVIS "Enable inclusion of a natvis files for debugging" ON "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"MSVC\"" OFF)
cmake_dependent_option(MORPHEUS_USE_MODULES "Enable C++20 modules support" ON "MODULES_SUPPORTED" OFF)


find_package(ClangTidy)
find_package(IWYU)
Expand Down
27 changes: 20 additions & 7 deletions cmake/morpheus_add_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,29 @@ function(morpheus_add_target_properties)
# Create an empty header set here so that the subsequent install step finds it.
if (NOT ${MORPHEUS_NO_INSTALL})
target_sources(${MORPHEUS_NAME} ${scope} FILE_SET HEADERS FILES)
if (MORPHEUS_USE_MODULES AND NOT MORPHEUS_INTERFACE)
target_sources(${MORPHEUS_NAME} ${scope} FILE_SET CXX_MODULES FILES)
endif()
endif()

if (NOT ${MORPHEUS_NO_INSTALL})
install(TARGETS ${MORPHEUS_NAME}
EXPORT morpheus-export-set
FILE_SET HEADERS
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
set(install_args
TARGETS ${MORPHEUS_NAME}
EXPORT morpheus-export-set
FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if (MORPHEUS_USE_MODULES AND NOT MORPHEUS_INTERFACE)
list(APPEND install_args FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()

list(APPEND install_args
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(${install_args})
endif()
endfunction()
6 changes: 3 additions & 3 deletions cmake/sanitisers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ FetchContent_Declare(
sanitizers
GIT_REPOSITORY https://github.com/arsenm/sanitizers-cmake
)
FetchContent_GetProperties(sanitizers)
if(NOT sanitizers_POPULATED)
FetchContent_Populate(sanitizers)
FetchContent_MakeAvailable(sanitizers)

if(sanitizers_SOURCE_DIR)
list(APPEND CMAKE_MODULE_PATH ${sanitizers_SOURCE_DIR}/cmake)
endif()

Expand Down
8 changes: 8 additions & 0 deletions libraries/core/lib/morpheus/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ target_sources(MorpheusCore
cpu.cpp
)

if (MORPHEUS_USE_MODULES)
target_sources(MorpheusCore
PUBLIC
FILE_SET CXX_MODULES
FILES core.cppm
)
endif()

add_subdirectory(base)
add_subdirectory(concurrency)
add_subdirectory(conformance)
Expand Down
8 changes: 8 additions & 0 deletions libraries/core/lib/morpheus/core/conformance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,11 @@ target_compile_definitions(MorpheusCore
PUBLIC
$<$<PLATFORM_ID:Darwin>:_GNU_SOURCE=1> # Boost stacktrace requires this for MacOS.
)

if (MORPHEUS_USE_MODULES)
target_sources(MorpheusCore
PUBLIC
FILE_SET CXX_MODULES
FILES conformance.cppm
)
endif()
16 changes: 16 additions & 0 deletions libraries/core/lib/morpheus/core/conformance/conformance.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module;

#include <morpheus/core/conformance/expected.hpp>
// #include <morpheus/core/conformance/format.hpp>
// #include <morpheus/core/conformance/ranges.hpp>
#include <morpheus/core/conformance/version.hpp>

export module morpheus.core:conformance;

export namespace morpheus::conf
{

namespace exp = ::morpheus::conf::exp;
// using ::morpheus::conf::exp;

} // namespace morpheus::conf
8 changes: 8 additions & 0 deletions libraries/core/lib/morpheus/core/conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ target_sources(MorpheusCore
FILES
string.hpp
)

if (MORPHEUS_USE_MODULES)
target_sources(MorpheusCore
PUBLIC
FILE_SET CXX_MODULES
FILES conversion.cppm
)
endif()
13 changes: 13 additions & 0 deletions libraries/core/lib/morpheus/core/conversion/conversion.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module;

#include <morpheus/core/conversion/string.hpp>

export module morpheus.core:conversion;

export namespace morpheus::core::conversion
{

// /namespace str = ::morpheus::core::conversion::str;
// using ::morpheus::conf::exp;

} // namespace morpheus::core::conversion
4 changes: 4 additions & 0 deletions libraries/core/lib/morpheus/core/core.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export module morpheus.core;

export import :conformance;
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
clang-format==22.1.3
cmake>=4.0.0
conan>=2.1.0
ninja
pre-commit
Loading