- Separated Platform and Compiler Dependent Behaviour into CMake scripts
- Implemented Basic Platform Interfaces
- Implemented partial Linux platform and Wayland Display.
- Implemented Dependencies for the above
- map
- set
- optional
- pair
TODO: threading
This commit is contained in:
106
CMakeLists.txt
106
CMakeLists.txt
@@ -1,34 +1,51 @@
|
||||
# ======================================================================================================================
|
||||
# fennec, a free and open source game engine
|
||||
# Copyright © 2025 Medusa Slockbower
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
# ======================================================================================================================
|
||||
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
project(fennec)
|
||||
|
||||
# External dependencies should be loaded here
|
||||
|
||||
# SDL is a dependency of the project, added as a git submodule
|
||||
add_subdirectory(external/sdl)
|
||||
|
||||
# CppTrace is a dependency of the project, added as a git submodule
|
||||
add_subdirectory(external/cpptrace)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_C_STANDARD 23)
|
||||
set(FENNEC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# include scripts
|
||||
include("${FENNEC_SOURCE_DIR}/cmake/platform.cmake")
|
||||
include("${FENNEC_SOURCE_DIR}/cmake/build.cmake")
|
||||
|
||||
# find dependencies
|
||||
find_package(Doxygen)
|
||||
fennec_check_platform()
|
||||
|
||||
# any necessary include directories
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
include_directories(${FENNEC_SOURCE_DIR}/include)
|
||||
|
||||
# Metaprogramming is a dependency for generating various type info before compilation of the engine.
|
||||
add_subdirectory(metaprogramming)
|
||||
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} FENNEC_BUILD_NAME)
|
||||
|
||||
message(STATUS "OS: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "Build: ${FENNEC_BUILD_NAME}")
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/${FENNEC_BUILD_NAME})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/${FENNEC_BUILD_NAME})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/${FENNEC_BUILD_NAME})
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${FENNEC_SOURCE_DIR}/lib/${FENNEC_BUILD_NAME})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${FENNEC_SOURCE_DIR}/lib/${FENNEC_BUILD_NAME})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${FENNEC_SOURCE_DIR}/bin/${FENNEC_BUILD_NAME})
|
||||
|
||||
# add the test suite as a sub-project
|
||||
add_subdirectory(test)
|
||||
@@ -42,6 +59,10 @@ add_library(fennec STATIC
|
||||
# CONTAINERS ===========================================================================================================
|
||||
include/fennec/containers/array.h
|
||||
include/fennec/containers/dynarray.h
|
||||
include/fennec/containers/map.h
|
||||
include/fennec/containers/optional.h
|
||||
include/fennec/containers/pair.h
|
||||
include/fennec/containers/set.h
|
||||
|
||||
|
||||
# LANG =================================================================================================================
|
||||
@@ -51,15 +72,17 @@ add_library(fennec STATIC
|
||||
include/fennec/lang/bits.h
|
||||
include/fennec/lang/constants.h
|
||||
include/fennec/lang/conditional_types.h
|
||||
include/fennec/lang/hashing.h
|
||||
include/fennec/lang/intrinsics.h
|
||||
include/fennec/lang/limits.h
|
||||
include/fennec/lang/numeric_transforms.h
|
||||
include/fennec/lang/sequences.h
|
||||
include/fennec/lang/type_identity.h
|
||||
include/fennec/lang/type_sequences.h
|
||||
include/fennec/lang/type_traits.h
|
||||
include/fennec/lang/type_transforms.h
|
||||
include/fennec/lang/types.h
|
||||
include/fennec/lang/utility.h
|
||||
include/fennec/lang/type_sequences.h
|
||||
include/fennec/lang/integer.h
|
||||
|
||||
include/fennec/lang/detail/__bits.h
|
||||
@@ -67,6 +90,7 @@ add_library(fennec STATIC
|
||||
include/fennec/lang/detail/__numeric_transforms.h
|
||||
include/fennec/lang/detail/__stdlib.h
|
||||
include/fennec/lang/detail/__type_traits.h
|
||||
include/fennec/lang/detail/__type_transforms.h
|
||||
include/fennec/lang/detail/__type_sequences.h
|
||||
|
||||
include/fennec/lang/assert.h source/lang/assert.cpp
|
||||
@@ -75,8 +99,9 @@ add_library(fennec STATIC
|
||||
# MEMORY ===============================================================================================================
|
||||
include/fennec/memory/new.h source/memory/new.cpp
|
||||
|
||||
include/fennec/memory/common.h
|
||||
include/fennec/memory/allocator.h
|
||||
include/fennec/memory/bytes.h
|
||||
include/fennec/memory/common.h
|
||||
include/fennec/memory/memory.h
|
||||
include/fennec/memory/pointers.h
|
||||
include/fennec/memory/ptr_traits.h
|
||||
@@ -110,10 +135,12 @@ add_library(fennec STATIC
|
||||
|
||||
include/fennec/math/ext/common.h
|
||||
include/fennec/math/ext/constants.h
|
||||
include/fennec/math/ext/primes.h
|
||||
include/fennec/math/ext/quaternion.h
|
||||
include/fennec/math/ext/transform.h
|
||||
include/fennec/math/ext/trigonometric.h
|
||||
|
||||
|
||||
include/fennec/math/detail/__fwd.h
|
||||
include/fennec/math/detail/__math.h
|
||||
include/fennec/math/detail/__matrix.h
|
||||
@@ -132,32 +159,34 @@ add_library(fennec STATIC
|
||||
# Filesystem
|
||||
include/fennec/fproc/filesystem/file.h source/fproc/filesystem/file.cpp
|
||||
include/fennec/fproc/filesystem/path.h source/fproc/filesystem/path.cpp
|
||||
|
||||
# PLATFORM =============================================================================================================
|
||||
include/fennec/platform/interface/fwd.h
|
||||
|
||||
include/fennec/platform/interface/dialog.h
|
||||
include/fennec/platform/interface/display.h
|
||||
include/fennec/platform/interface/window.h source/platform/interface/window.cpp
|
||||
include/fennec/platform/interface/platform.h source/platform/interface/platform.cpp
|
||||
|
||||
|
||||
${FENNEC_EXTRA_SOURCES}
|
||||
)
|
||||
|
||||
# add metaprogramming templates as a dependency and also force documentation to be generated when fennec is compiled
|
||||
if(DOXYGEN_FOUND)
|
||||
add_dependencies(fennec fennecdocs metaprogramming) # SDL3-shared cpptrace::cpptrace)
|
||||
else()
|
||||
add_dependencies(fennec metaprogramming) # SDL3-shared cpptrace::cpptrace)
|
||||
endif()
|
||||
add_dependencies(fennec metaprogramming)
|
||||
|
||||
# Compiler Warning Flags
|
||||
if(MSVC)
|
||||
add_compile_options("/W4" "/WX") # All MSVC Warnings throw as Errors
|
||||
else()
|
||||
add_compile_options("-Wall" "-Wextra" "-pedantic" "-Werror") # All gcc/etc. Warnings throw as errors
|
||||
|
||||
target_compile_definitions(fennec PRIVATE _GLIBCXX_INCLUDE_NEXT_C_HEADERS __USE_FILE_OFFSET64)
|
||||
endif()
|
||||
|
||||
target_compile_options(fennec PUBLIC "-mavx" "-mavx2" "-mavx512f") # SIMD Instructions, automatic vectorization will occur
|
||||
target_compile_definitions(fennec PUBLIC
|
||||
${FENNEC_COMPILE_DEFINITIONS}
|
||||
)
|
||||
|
||||
|
||||
target_link_options(fennec PRIVATE "-nostdlib" "-fno-exceptions" "-fno-rtti" "-fdiagnostics-all-candidates") # Do not compile base fennec library with c++ stdlib
|
||||
target_link_options(fennec PRIVATE ${FENNEC_PRIVATE_LINK_OPTIONS}) # Do not compile base fennec library with c++ stdlib
|
||||
# fennec does not use the C++ stdlib because it is bloated, difficult to read, and implementation defined.
|
||||
# This implementation is designed to be as readable as possible, and expose information that would otherwise be obfuscated
|
||||
|
||||
target_link_libraries(fennec PRIVATE SDL3-shared cpptrace::cpptrace)
|
||||
target_link_libraries(fennec PRIVATE
|
||||
cpptrace::cpptrace
|
||||
${FENNEC_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -167,10 +196,11 @@ target_link_libraries(fennec PRIVATE SDL3-shared cpptrace::cpptrace)
|
||||
file(COPY logo DESTINATION docs/logo)
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
set(DOXY_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/docs")
|
||||
get_filename_component(DOXYGEN_PROJECT_NAME ${PROJECT_SOURCE_DIR} NAME) # Set Doxy Project name to the name of the root dir
|
||||
set(DOXYGEN_CONFIG_IN "${PROJECT_SOURCE_DIR}/doxy/Doxyfile.in") # Input config file with preprocessor arguments
|
||||
set(DOXYGEN_CONFIG_OUT "${PROJECT_SOURCE_DIR}/doxy/Doxyfile") # Generated config file from input
|
||||
add_dependencies(fennec fennecdocs)
|
||||
set(DOXY_OUTPUT_DIR "${FENNEC_SOURCE_DIR}/docs")
|
||||
get_filename_component(DOXYGEN_PROJECT_NAME ${FENNEC_SOURCE_DIR} NAME) # Set Doxy Project name to the name of the root dir
|
||||
set(DOXYGEN_CONFIG_IN "${FENNEC_SOURCE_DIR}/doxy/Doxyfile.in") # Input config file with preprocessor arguments
|
||||
set(DOXYGEN_CONFIG_OUT "${FENNEC_SOURCE_DIR}/doxy/Doxyfile") # Generated config file from input
|
||||
|
||||
configure_file(${DOXYGEN_CONFIG_IN} ${DOXYGEN_CONFIG_OUT} @ONLY) # Execute preprocessing step
|
||||
message("Doxygen Build Started.")
|
||||
@@ -179,8 +209,8 @@ if(DOXYGEN_FOUND)
|
||||
# Target for building docs
|
||||
add_custom_target(fennecdocs ALL
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_CONFIG_OUT}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/logo/raster.png
|
||||
WORKING_DIRECTORY ${FENNEC_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${FENNEC_SOURCE_DIR}/logo/raster.png
|
||||
${DOXY_OUTPUT_DIR}/logo/raster.png
|
||||
COMMENT "Generating Doxygen Documentation"
|
||||
VERBATIM)
|
||||
@@ -189,7 +219,7 @@ if(DOXYGEN_FOUND)
|
||||
|
||||
# Target for cleaning docs
|
||||
add_custom_target(fennecdocs-clean ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f "${PROJECT_SOURCE_DIR}/docs"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f "${FENNEC_SOURCE_DIR}/docs"
|
||||
COMMENT "Cleaning Doxygen Documentation"
|
||||
VERBATIM)
|
||||
else()
|
||||
|
||||
Reference in New Issue
Block a user