Skip to content

Commit

Permalink
Fix project tree, added back tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamakaio committed Jun 18, 2024
1 parent 30756c4 commit 9bed468
Show file tree
Hide file tree
Showing 151 changed files with 358 additions and 79 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ ADD_SUBDIRECTORY(3rdparty)
ADD_SUBDIRECTORY(src)

# Unit Tests
#ADD_SUBDIRECTORY(test)

IF (NOT OSP_BUILD_GDEXTENSION)
ADD_SUBDIRECTORY(test)
ENDIF()
# Set OSP as default startup project in Visual Studio
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT osp-magnum)
# Set execution directory of osp-magnum so that we don't have to copy the files
if (OSP_BUILD_GDEXTENSION EQUAL OFF)
if (NOT OSP_BUILD_GDEXTENSION)
set_property(TARGET osp-magnum PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
endif()
17 changes: 15 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,29 @@

# TODO put that in the right place.

set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
if(NOT Threads_FOUND)
message(FATAL_ERROR "Can't find a thread library to use!")
endif()

#compile as position-independant to avoid link errors on static link
add_compile_options("-fPIC")

add_subdirectory(common)
add_subdirectory(adera)
add_subdirectory(osp)
add_subdirectory(planet-a)
add_subdirectory(ospjolt)

if(OSP_BUILD_GDEXTENSION)

add_subdirectory(gdextension)

else()

add_subdirectory(standalone)
add_subdirectory(testapp)
add_subdirectory(osp_drawing_gl)
add_subdirectory(adera_drawing_gl)

endif()

57 changes: 57 additions & 0 deletions src/adera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
##
# Open Space Program
# Copyright © 2019-2024 Open Space Program Project
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
##

find_package(Magnum REQUIRED
Trade
AnyImageImporter
)

find_package(MagnumPlugins REQUIRED
TinyGltfImporter
StbImageImporter)

SET(DEPS_LIBS
EnTT::EnTT
Corrade::Main
Magnum::Magnum
Magnum::Trade
longeron
spdlog
OpenSpaceProgram)

add_library(Adera STATIC)

target_compile_features(Adera PUBLIC cxx_std_20)

# Link it to the interface library that describes the dependencies
target_link_libraries(Adera PRIVATE ${DEPS_LIBS})

# Gather paths to OSP headers and sources
file(GLOB_RECURSE CPP_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE H_FILES CONFIGURE_DEPENDS *.h)
target_sources(Adera PRIVATE "${CPP_FILES}" "${H_FILES}")

# Enforce conformance mode for adera
target_compile_options(Adera PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/permissive->)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions src/adera_drawing_gl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
##
# Open Space Program
# Copyright © 2019-2024 Open Space Program Project
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
##

find_package(Magnum REQUIRED
GL
Shaders
MeshTools
Primitives
Trade
)

SET(DEPS_LIBS
Corrade::Main
Magnum::GL
Magnum::Magnum
Magnum::MeshTools
Magnum::Primitives
Magnum::Shaders
Magnum::Trade
OpenSpaceProgram
longeron
OspGL)

add_library(AderaGL STATIC)

target_compile_features(AderaGL PUBLIC cxx_std_20)

# Link it to the interface library that describes the dependencies
target_link_libraries(AderaGL PRIVATE ${DEPS_LIBS})

# Gather paths to OSP headers and sources
file(GLOB_RECURSE CPP_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE H_FILES CONFIGURE_DEPENDS *.h)
target_sources(AderaGL PRIVATE "${CPP_FILES}" "${H_FILES}")

# Enforce conformance mode for adera
target_compile_options(AderaGL PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/permissive->)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
#pragma once

#include <drawing_gl/rendergl.h>
#include <osp_drawing_gl/rendergl.h>

#include <Magnum/Shaders/FlatGL.h>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
#pragma once

#include <drawing_gl/rendergl.h>
#include <osp_drawing_gl/rendergl.h>

#include <Magnum/Shaders/PhongGL.h>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
#pragma once

#include <drawing_gl/rendergl.h>
#include <osp_drawing_gl/rendergl.h>

#include <Magnum/Shaders/MeshVisualizerGL.h>

Expand Down
2 changes: 1 addition & 1 deletion src/gdextension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ target_sources(osp-gdextension PRIVATE "${CPP_FILES}" "${H_FILES}")

target_include_directories(osp-gdextension PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(osp-gdextension PRIVATE godot-cpp osp-common)
target_link_libraries(osp-gdextension PRIVATE godot-cpp OpenSpaceProgram Adera PlanetA OspJolt)

target_compile_options(osp-gdextension PRIVATE "-static")

Expand Down
2 changes: 1 addition & 1 deletion src/gdextension/Example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "godot_cpp/classes/label.hpp"
#include "godot_cpp/core/class_db.hpp"
#include "godot_cpp/variant/utility_functions.hpp"
#include "ospjolt/activescene/joltinteg.h"
#include "ospjolt/joltinteg.h"

#include "Example.h"

Expand Down
63 changes: 63 additions & 0 deletions src/osp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
##
# Open Space Program
# Copyright © 2019-2024 Open Space Program Project
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
##

find_package(Magnum REQUIRED
Trade
AnyImageImporter
)

find_package(MagnumPlugins REQUIRED
TinyGltfImporter
StbImageImporter)

SET(OSP_DEPS_LIBS
Threads::Threads
EnTT::EnTT
Corrade::Main
Magnum::Magnum
Magnum::Trade
Magnum::AnyImageImporter
MagnumPlugins::TinyGltfImporter
MagnumPlugins::StbImageImporter
toml11
spdlog
longeron)

add_library(OpenSpaceProgram STATIC)

target_compile_features(OpenSpaceProgram PUBLIC cxx_std_20)

target_include_directories(OpenSpaceProgram PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")

# Link it to the interface library that describes the dependencies
target_link_libraries(OpenSpaceProgram PUBLIC ${OSP_DEPS_LIBS})

# Gather paths to OSP headers and sources
file(GLOB_RECURSE CPP_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE H_FILES CONFIGURE_DEPENDS *.h)
target_sources(OpenSpaceProgram PRIVATE "${CPP_FILES}" "${H_FILES}")

# Enforce conformance mode for osp-magnum
target_compile_options(OpenSpaceProgram PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/permissive->)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
70 changes: 34 additions & 36 deletions src/common/CMakeLists.txt → src/osp_drawing_gl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
##
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
if(NOT Threads_FOUND)
message(FATAL_ERROR "Can't find a thread library to use!")
endif()

find_package(Magnum REQUIRED
GL
Shaders
MeshTools
Primitives
Trade
AnyImageImporter
)
Expand All @@ -38,55 +36,55 @@ find_package(MagnumPlugins REQUIRED
TinyGltfImporter
StbImageImporter)

add_library(osp-common-deps INTERFACE)
add_custom_target(compile-osp-common-deps)

# TODO: This list shouldn't be required, but there appears to be a bug in cmake where
# the add_custom_target() command, pointing to an INTERFACE dependency, doesn't
# result in the dependencies of the interface building.
# See: https://gitlab.kitware.com/cmake/cmake/-/issues/23569
SET(OSP_COMMON_DEPS_LIBS
SET(DEPS_LIBS
Threads::Threads
EnTT::EnTT
Corrade::Main
Magnum::GL
Magnum::Magnum
Magnum::MeshTools
Magnum::Primitives
Magnum::Shaders
Magnum::Trade
Magnum::AnyImageImporter
MagnumPlugins::TinyGltfImporter
MagnumPlugins::StbImageImporter
toml11
spdlog
longeron
Jolt)
target_link_libraries(osp-common-deps INTERFACE ${OSP_COMMON_DEPS_LIBS})
add_dependencies(compile-osp-common-deps ${OSP_COMMON_DEPS_LIBS})

add_library(osp-common STATIC)
OpenSpaceProgram)

target_compile_options(osp-common PRIVATE "-fPIC")
target_compile_features(osp-common PUBLIC cxx_std_20)
add_library(OspGL STATIC)

target_include_directories(osp-common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_features(OspGL PUBLIC cxx_std_20)

# Link it to the interface library that describes the dependencies
target_link_libraries(osp-common PUBLIC osp-common-deps)
target_link_libraries(OspGL PRIVATE ${DEPS_LIBS})

# Gather paths to OSP headers and sources
file(GLOB_RECURSE CPP_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE H_FILES CONFIGURE_DEPENDS *.h)
target_sources(osp-common PRIVATE "${CPP_FILES}" "${H_FILES}")
target_sources(OspGL PRIVATE "${CPP_FILES}" "${H_FILES}")

# Add shaders to IDE project
set(SHADERS_DIR "../../bin/OSPData/adera/Shaders")
file (GLOB_RECURSE SHADER_FILES CONFIGURE_DEPENDS
"${SHADERS_DIR}/*.vert"
"${SHADERS_DIR}/*.frag"
"${SHADERS_DIR}/*.comp"
)
# For some reason, source_group() requires all files to be added to the executable
target_sources(OspGL PRIVATE "${SHADER_FILES}")

# Segregate headers into filters
# Segregate headers, shaders into filters
source_group("Shader Files" FILES ${SHADER_FILES})
source_group("Header Files" FILES ${H_FILES})

# Enforce conformance mode for osp-common
target_compile_options(osp-common PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/permissive->)
# Enforce conformance mode for OspGL
target_compile_options(OspGL PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/permissive->)

set_target_properties(osp-common PROPERTIES
EXPORT_COMPILE_COMMANDS TRUE
INSTALL_RPATH "$ORIGIN/lib"
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)

# Copy root/bin to build/bin after building
add_custom_command(TARGET OspGL
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/../../bin" "${CMAKE_BINARY_DIR}/$<CONFIG>"
VERBATIM
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9bed468

Please sign in to comment.