Skip to content

Commit 52e130a

Browse files
authored
Merge pull request #58 from DaniAffCH/refactoring
Refactoring
2 parents a5a859e + d572810 commit 52e130a

140 files changed

Lines changed: 987 additions & 857 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ StyleCopReport.xml
8989
*.ilk
9090
*.meta
9191
*.obj
92+
# Exception: track 3D mesh files in resources
93+
!resources/**/*.obj
9294
*.idb
9395
*.iobj
9496
*.pch

CMakeLists.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ cmake_minimum_required(VERSION 3.16)
33
project(circus VERSION 0.1.0 LANGUAGES CXX)
44
add_compile_definitions(_LIBCPP_DISABLE_AVAILABILITY)
55

6-
set(LIBRARY ${PROJECT_NAME})
7-
set(EXECUTABLE ${PROJECT_NAME}-main)
6+
set(LIBRARY ${PROJECT_NAME}-lib)
7+
set(EXECUTABLE ${PROJECT_NAME})
88
set(CMAKE_CXX_STANDARD 20)
99
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1010
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
1111
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
1212
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
13-
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/.clangd"
14-
"CompileFlags:\n CompilationDatabase: ${CMAKE_CURRENT_BINARY_DIR}\n")
1513
add_compile_definitions(PROJECT_ROOT="${CMAKE_SOURCE_DIR}")
1614
include(FetchContent)
1715

@@ -36,6 +34,11 @@ find_package(Qt6 REQUIRED COMPONENTS Core Widgets OpenGLWidgets)
3634
find_package(nlohmann_json QUIET)
3735
find_package(CURL QUIET)
3836

37+
# Generate .clangd configuration after dependencies are found
38+
get_target_property(EIGEN_INCLUDE_DIR Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES)
39+
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/.clangd"
40+
"CompileFlags:\n CompilationDatabase: ${CMAKE_CURRENT_BINARY_DIR}\n Add:\n - -I${CMAKE_CURRENT_SOURCE_DIR}/include\n - -isystem${EIGEN_INCLUDE_DIR}\n")
41+
3942
# -------------------- yaml-cpp (config -> module -> manual) [robust]
4043
set(_YAML_HINT "/opt/homebrew/opt/yaml-cpp")
4144
find_package(yaml-cpp CONFIG QUIET)
@@ -119,8 +122,8 @@ endif()
119122
# ======================= CIRCUS LIBRARY ============================================================
120123

121124
# -------------------- Collect sources and split into: core, main, bindings
122-
set(_src_dir "${CMAKE_SOURCE_DIR}/Src")
123-
set(_include_dir "${CMAKE_SOURCE_DIR}/Include")
125+
set(_src_dir "${CMAKE_SOURCE_DIR}/src")
126+
set(_include_dir "${CMAKE_SOURCE_DIR}/include")
124127

125128
# Source files
126129
file(GLOB_RECURSE SOURCES ${_src_dir}/*.cpp)
@@ -201,16 +204,20 @@ include(CMakePackageConfigHelpers)
201204
include(GNUInstallDirs)
202205

203206
# 1. Install the library target and headers
204-
set_target_properties(${LIBRARY} PROPERTIES PUBLIC_HEADER "${HEADERS}")
205207
install(TARGETS ${LIBRARY}
206208
EXPORT ${LIBRARY}Targets
207209
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
208210
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
209211
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
210-
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
211212
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
212213
)
213214

215+
# Install headers preserving directory structure
216+
install(DIRECTORY ${_include_dir}/
217+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
218+
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
219+
)
220+
214221
# 2. Generate the relocatable package config file in the build directory
215222
configure_package_config_file( # creates config file for find_package
216223
"cmake/config.cmake.in"

0 commit comments

Comments
 (0)