From 6247832ccac5a8e414990828c079fa3b233c8508 Mon Sep 17 00:00:00 2001 From: David Allemang Date: Sun, 5 Feb 2023 17:19:25 -0500 Subject: [PATCH] COMP: Reorganize cmake files --- CMakeLists.txt | 16 +++++----------- {vendor => cmake}/embed.cmake | 1 + examples/CMakeLists.txt | 1 - {vendor => ext}/eigen.cmake | 0 {vendor => ext}/entt.cmake | 0 {vendor => ext}/fmt.cmake | 0 {vendor => ext}/glad.cmake | 0 {vendor => ext}/glfw.cmake | 0 {vendor => ext}/gtest.cmake | 0 {vendor => ext}/peglib.cmake | 0 {vendor => ext}/yaml-cpp.cmake | 0 tc/CMakeLists.txt | 2 +- vendor/toddcox.cmake | 12 ------------ vis/CMakeLists.txt | 20 ++------------------ 14 files changed, 9 insertions(+), 43 deletions(-) rename {vendor => cmake}/embed.cmake (97%) delete mode 100644 examples/CMakeLists.txt rename {vendor => ext}/eigen.cmake (100%) rename {vendor => ext}/entt.cmake (100%) rename {vendor => ext}/fmt.cmake (100%) rename {vendor => ext}/glad.cmake (100%) rename {vendor => ext}/glfw.cmake (100%) rename {vendor => ext}/gtest.cmake (100%) rename {vendor => ext}/peglib.cmake (100%) rename {vendor => ext}/yaml-cpp.cmake (100%) delete mode 100644 vendor/toddcox.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f473647..c691029 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,18 +3,12 @@ project(toddcox-faster) set(CMAKE_CXX_STANDARD 20) -include(vendor/eigen.cmake) -include(vendor/entt.cmake) -include(vendor/fmt.cmake) -include(vendor/glad.cmake) -include(vendor/glfw.cmake) -include(vendor/gtest.cmake) -include(vendor/peglib.cmake) -include(vendor/yaml-cpp.cmake) +file(GLOB externals ext/*.cmake) +foreach (external ${externals}) + include(${external}) +endforeach () -include(vendor/embed.cmake) +include(cmake/embed.cmake) add_subdirectory(tc) add_subdirectory(vis) - -add_subdirectory(examples) diff --git a/vendor/embed.cmake b/cmake/embed.cmake similarity index 97% rename from vendor/embed.cmake rename to cmake/embed.cmake index 06f71de..ba2de08 100644 --- a/vendor/embed.cmake +++ b/cmake/embed.cmake @@ -52,6 +52,7 @@ function(_embed_file OUTPUT_OBJECT FILE) COMMENT "Embedding ${FILE} in ${OBJECT}" OUTPUT "${FILE}.o" DEPENDS "${FILE}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${EMBED_LD} -r -o "${OBJECT}" --format=binary "${FILE}" COMMAND ${EMBED_OBJCOPY} --rename-section .data=.rodata,alloc,load,readonly,data,contents "${OBJECT}" VERBATIM diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt deleted file mode 100644 index 00c6b21..0000000 --- a/examples/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -# there's no examples right now. \ No newline at end of file diff --git a/vendor/eigen.cmake b/ext/eigen.cmake similarity index 100% rename from vendor/eigen.cmake rename to ext/eigen.cmake diff --git a/vendor/entt.cmake b/ext/entt.cmake similarity index 100% rename from vendor/entt.cmake rename to ext/entt.cmake diff --git a/vendor/fmt.cmake b/ext/fmt.cmake similarity index 100% rename from vendor/fmt.cmake rename to ext/fmt.cmake diff --git a/vendor/glad.cmake b/ext/glad.cmake similarity index 100% rename from vendor/glad.cmake rename to ext/glad.cmake diff --git a/vendor/glfw.cmake b/ext/glfw.cmake similarity index 100% rename from vendor/glfw.cmake rename to ext/glfw.cmake diff --git a/vendor/gtest.cmake b/ext/gtest.cmake similarity index 100% rename from vendor/gtest.cmake rename to ext/gtest.cmake diff --git a/vendor/peglib.cmake b/ext/peglib.cmake similarity index 100% rename from vendor/peglib.cmake rename to ext/peglib.cmake diff --git a/vendor/yaml-cpp.cmake b/ext/yaml-cpp.cmake similarity index 100% rename from vendor/yaml-cpp.cmake rename to ext/yaml-cpp.cmake diff --git a/tc/CMakeLists.txt b/tc/CMakeLists.txt index f17105a..a57f4d2 100644 --- a/tc/CMakeLists.txt +++ b/tc/CMakeLists.txt @@ -8,7 +8,7 @@ add_library(tc src/lang.cpp src/solve.cpp ) -target_link_libraries(tc peglib::peglib fmt::fmt) +target_link_libraries(tc peglib fmt) target_include_directories(tc PUBLIC include) add_library(tc::tc ALIAS tc) diff --git a/vendor/toddcox.cmake b/vendor/toddcox.cmake deleted file mode 100644 index 0159cce..0000000 --- a/vendor/toddcox.cmake +++ /dev/null @@ -1,12 +0,0 @@ -include(FetchContent) - -FetchContent_Declare( - toddcox - GIT_REPOSITORY https://github.com/jcraymond/toddcox-faster.git - GIT_TAG 265de59917bdf94709b40ad8aef5dd9ce5574242 - GIT_PROGRESS TRUE -) - -set(TC_BUILD_EXAMPLE OFF CACHE INTERNAL "") - -FetchContent_MakeAvailable(toddcox) diff --git a/vis/CMakeLists.txt b/vis/CMakeLists.txt index 7f962f9..2a7cf09 100644 --- a/vis/CMakeLists.txt +++ b/vis/CMakeLists.txt @@ -1,10 +1,3 @@ -#add_custom_target(shaders ALL DEPENDS shader_output) -#add_custom_command( -# OUTPUT shader_output -# COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${CMAKE_CURRENT_BINARY_DIR}/shaders -# COMMENT "copied shaders" -#) - add_subdirectory(shaders) add_custom_target(presets ALL DEPENDS preset_output) @@ -14,22 +7,13 @@ add_custom_command( COMMENT "copied preses" ) -add_library(vis-util INTERFACE) -target_include_directories(vis-util INTERFACE include) - add_executable(vis src/main.cpp src/comps.hpp ) target_include_directories(vis PRIVATE include) target_link_libraries(vis PRIVATE - tc - glad - eigen - glfw - yaml-cpp - shaders - fmt::fmt - EnTT::EnTT + tc shaders + glad eigen glfw yaml-cpp fmt EnTT ) add_dependencies(vis presets)