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
30 changes: 0 additions & 30 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
[submodule "ext/glm"]
path = ext/glm
url = https://github.com/g-truc/glm.git
[submodule "ext/freetype2"]
path = ext/freetype2
url = https://github.com/freetype/freetype
[submodule "ext/assimp"]
path = ext/assimp
url = https://github.com/assimp/assimp.git
[submodule "ext/lua/src"]
path = ext/lua/src
url = https://github.com/Lua/Lua.git
[submodule "ext/glbinding"]
path = ext/glbinding
url = https://github.com/cginternals/glbinding.git
[submodule "ext/websocketpp"]
path = ext/websocketpp
url = https://github.com/OpenSpace/websocketpp
[submodule "ext/tiny-process-library"]
path = ext/tiny-process-library
url = https://github.com/OpenSpace/tiny-process-library.git
[submodule "ext/tracy"]
path = ext/tracy
url = https://github.com/wolfpld/tracy.git
[submodule "ext/catch2"]
path = ext/catch2
url = https://github.com/catchorg/Catch2.git
[submodule "ext/scnlib"]
path = ext/scnlib
url = https://github.com/eliaskosunen/scnlib.git
[submodule "support/cmake/common-compile-settings"]
path = support/cmake/common-compile-settings
url = https://github.com/OpenSpace/common-compile-settings
58 changes: 42 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
##########################################################################################

cmake_minimum_required(VERSION 4.0)
project(Ghoul LANGUAGES C CXX)

# Setting default paths
set(GHOUL_ROOT_DIR ${PROJECT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${GHOUL_ROOT_DIR}/support/cmake)

include(${GHOUL_ROOT_DIR}/support/cmake/message_macros.cmake)

begin_header("Configuring Ghoul Project")
# The options gating optional dependencies have to be declared before the first project()
# call: that is when vcpkg's toolchain file runs and reads VCPKG_MANIFEST_FEATURES.
#
# vcpkg only reads VCPKG_MANIFEST_FEATURES on the configure that first creates the build
# directory. Changing any of the options below afterwards will not add or remove the
# corresponding dependency: delete build/<preset>/vcpkg_installed (or the whole build
# directory) and configure again.

#############################
# Options
Expand All @@ -41,16 +40,39 @@ option(GHOUL_HIGH_DEBUG_MODE "Add additional debugging code" ON)
option(GHOUL_LOGGING_ENABLE_TRACE "Enables the LTRACE macro" ON)
option(GHOUL_THROW_ON_ASSERT "Disables the feedback on asserts; for use in unit tests" OFF)

option(GHOUL_MODULE_ASSIMP "Enable AssImp Model loader" ON)
option(GHOUL_MODULE_COMMANDLINEPARSER "Enable Commandlineparser" ON)
option(GHOUL_MODULE_FONTRENDERING "Enable Fontrendering" ON)
option(GHOUL_MODULE_LUA "Enable Lua" ON)
option(GHOUL_MODULE_OPENGL "Enable OpenGL" ON)
option(GHOUL_MODULE_SYSTEMCAPABILITIES "Enable System Capabilities" ON)
option(GHOUL_HAVE_TESTS "Activate the unit tests" ON)
option(TRACY_ENABLE "Enable profiling with Tracy" OFF)

# The tests pull in Catch2 and the install rules are of no use to a project that consumes
# Ghoul, so both default to on only when Ghoul is the top-level project. project() has not
# run yet, so PROJECT_IS_TOP_LEVEL is not available and the directory comparison stands in.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
option(GHOUL_HAVE_TESTS "Activate the unit tests" ON)
option(GHOUL_ENABLE_INSTALL "Generate the install and export rules for Ghoul" ON)
else ()
option(GHOUL_HAVE_TESTS "Activate the unit tests" OFF)
option(GHOUL_ENABLE_INSTALL "Generate the install and export rules for Ghoul" OFF)
endif ()

option(BUILD_SHARED_LIBS "Build package with shared libraries" OFF)

# The optional switches above are translated into vcpkg manifest features
if (TRACY_ENABLE)
list(APPEND VCPKG_MANIFEST_FEATURES "profiling")
endif ()
if (GHOUL_HAVE_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "tests")
endif ()

project(Ghoul VERSION 0.1.0 LANGUAGES C CXX)

# Setting default paths
set(GHOUL_ROOT_DIR ${PROJECT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${GHOUL_ROOT_DIR}/support/cmake)

include(${GHOUL_ROOT_DIR}/support/cmake/message_macros.cmake)

begin_header("Configuring Ghoul Project")

if (WIN32)
option(GHOUL_ENABLE_EDIT_CONTINUE "Enable Edit&Continue" ON)

Expand All @@ -62,11 +84,15 @@ endif ()


add_subdirectory(src)
add_subdirectory(ext SYSTEM)

if (GHOUL_ENABLE_INSTALL)
include(${GHOUL_ROOT_DIR}/support/cmake/ghoul_install.cmake)
endif ()

# Other applications
if (GHOUL_HAVE_TESTS)
begin_header("Generating unit test")
enable_testing()
add_subdirectory(tests)
end_header()
endif ()
Expand Down
164 changes: 164 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 4,
"minor": 0,
"patch": 0
},
"configurePresets": [
{
"name": "vcpkg",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "windows-base",
"hidden": true,
"inherits": "vcpkg",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "windows",
"inherits": "windows-base",
"displayName": "Windows x64",
"description": "Multi-config build; static dependencies against the dynamic CRT. The glbinding overlay port only supports static linkage, so unlike SGCT this triplet is not x64-windows",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static-md"
}
},
{
"name": "windows-static",
"inherits": "windows-base",
"displayName": "Windows x64 (static CRT)",
"description": "Links the dependencies and the CRT statically so that a static Ghoul needs no accompanying DLLs",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
}
},
{
"name": "linux-base",
"hidden": true,
"inherits": "vcpkg",
"generator": "Ninja",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-linux"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "linux",
"inherits": "linux-base",
"displayName": "Linux x64 RelWithDebInfo",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "linux-debug",
"inherits": "linux-base",
"displayName": "Linux x64 Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "linux-release",
"inherits": "linux-base",
"displayName": "Linux x64 Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "windows",
"configurePreset": "windows",
"configuration": "RelWithDebInfo"
},
{
"name": "windows-debug",
"configurePreset": "windows",
"configuration": "Debug"
},
{
"name": "windows-release",
"configurePreset": "windows",
"configuration": "Release"
},
{
"name": "windows-static",
"configurePreset": "windows-static",
"configuration": "RelWithDebInfo"
},
{
"name": "linux",
"configurePreset": "linux"
},
{
"name": "linux-debug",
"configurePreset": "linux-debug"
},
{
"name": "linux-release",
"configurePreset": "linux-release"
}
],
"testPresets": [
{
"name": "output-on-failure",
"hidden": true,
"output": {
"outputOnFailure": true
}
},
{
"name": "windows",
"inherits": "output-on-failure",
"configurePreset": "windows",
"configuration": "RelWithDebInfo"
},
{
"name": "windows-debug",
"inherits": "output-on-failure",
"configurePreset": "windows",
"configuration": "Debug"
},
{
"name": "windows-release",
"inherits": "output-on-failure",
"configurePreset": "windows",
"configuration": "Release"
},
{
"name": "windows-static",
"inherits": "output-on-failure",
"configurePreset": "windows-static",
"configuration": "RelWithDebInfo"
},
{
"name": "linux",
"inherits": "output-on-failure",
"configurePreset": "linux"
},
{
"name": "linux-debug",
"inherits": "output-on-failure",
"configurePreset": "linux-debug"
},
{
"name": "linux-release",
"inherits": "output-on-failure",
"configurePreset": "linux-release"
}
]
}
Loading