From 724fd9abae7a42029beb7be826d0d63bacbfc93c Mon Sep 17 00:00:00 2001 From: Dimo Markov Date: Mon, 9 Oct 2023 00:16:25 +0300 Subject: [PATCH] Removed repo dispatch; Externals built in build dir; CMake improvements --- .github/workflows/ci.yml | 2 +- .github/workflows/dispatch.yml | 21 ----------------- CMakeLists.txt | 6 ++--- LangulusUtilities.cmake | 42 +++++++--------------------------- test/CMakeLists.txt | 10 ++++---- 5 files changed, 18 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/dispatch.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49212a9..05c0270 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: Langulus::Fractalloc CI -on: [push, repository_dispatch] +on: push concurrency: group: ${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml deleted file mode 100644 index 0ce9bc2..0000000 --- a/.github/workflows/dispatch.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Dispatch to dependents -on: - push: - branches: - - main -jobs: - build: - strategy: - fail-fast: false - matrix: - dependents: [Anyness, Flow, Math, Entity] - name: Trigger Langulus::${{matrix.dependents}}'s workflow - runs-on: ubuntu-latest - steps: - - run: > - curl - -X POST - -H "Accept: application/vnd.github+json" - -H "Authorization: Bearer ${{secrets.TRIGGER_WORKFLOWS}}" - https://api.github.com/repos/Langulus/${{matrix.dependents}}/dispatches - -d '{"event_type":"[Fractalloc] ${{github.event.head_commit.message}}","client_payload":{"cause":"Fractalloc"}}' \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f671623..e2084a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,9 @@ if(PROJECT_IS_TOP_LEVEL OR NOT LANGULUS) ) # Add Langulus::Core/Logger/RTTI libraries - fetch_langulus_module(Core) - fetch_langulus_module(Logger) - fetch_langulus_module(RTTI) + fetch_langulus_module(Core GIT_TAG 39ae88b) + fetch_langulus_module(Logger GIT_TAG 3314fbe) + fetch_langulus_module(RTTI GIT_TAG 3e05451) endif() if (NOT LANGULUS_FEATURE_MANAGED_MEMORY) diff --git a/LangulusUtilities.cmake b/LangulusUtilities.cmake index d3af0b8..62caebb 100644 --- a/LangulusUtilities.cmake +++ b/LangulusUtilities.cmake @@ -1,20 +1,20 @@ include(FetchContent) -function(fetch_langulus_module NAME) +function(fetch_langulus_module NAME GIT_TAG TAG) if(NOT DEFINED LANGULUS_EXTERNAL_DIRECTORY) set(LANGULUS_EXTERNAL_DIRECTORY "${CMAKE_SOURCE_DIR}/external" CACHE PATH - "Place where external dependencies will be downloaded and configured") + "Place where external dependencies will be downloaded") message(WARNING "LANGULUS_EXTERNAL_DIRECTORY not defined, using default: ${LANGULUS_EXTERNAL_DIRECTORY}") endif() - message(STATUS "Fetching external Langulus${NAME}...") + message(STATUS "Fetching external Langulus::${NAME}...") FetchContent_Declare( Langulus${NAME} GIT_REPOSITORY https://github.com/Langulus/${NAME}.git - GIT_TAG main + GIT_TAG ${TAG} GIT_SHALLOW TRUE - SOURCE_DIR ${LANGULUS_EXTERNAL_DIRECTORY}/${NAME}-src - SUBBUILD_DIR ${LANGULUS_EXTERNAL_DIRECTORY}/${NAME}-subbuild + SOURCE_DIR "${LANGULUS_EXTERNAL_DIRECTORY}/${NAME}-src" + SUBBUILD_DIR "${CMAKE_BINARY_DIR}/external/${NAME}-subbuild" ${ARGN} ) FetchContent_MakeAvailable(Langulus${NAME}) @@ -23,7 +23,7 @@ endfunction() function(fetch_external_module NAME GIT_REPOSITORY REPO GIT_TAG TAG) if(NOT DEFINED LANGULUS_EXTERNAL_DIRECTORY) set(LANGULUS_EXTERNAL_DIRECTORY "${CMAKE_SOURCE_DIR}/external" CACHE PATH - "Place where external dependencies will be downloaded and configured") + "Place where external dependencies will be downloaded") message(WARNING "LANGULUS_EXTERNAL_DIRECTORY not defined, using default: ${LANGULUS_EXTERNAL_DIRECTORY}") endif() @@ -33,7 +33,7 @@ function(fetch_external_module NAME GIT_REPOSITORY REPO GIT_TAG TAG) GIT_REPOSITORY ${REPO} GIT_TAG ${TAG} SOURCE_DIR "${LANGULUS_EXTERNAL_DIRECTORY}/${NAME}-src" - SUBBUILD_DIR "${LANGULUS_EXTERNAL_DIRECTORY}/${NAME}-subbuild" + SUBBUILD_DIR "${CMAKE_BINARY_DIR}/external/${NAME}-subbuild" ${ARGN} ) FetchContent_MakeAvailable(${NAME}) @@ -43,19 +43,6 @@ function(fetch_external_module NAME GIT_REPOSITORY REPO GIT_TAG TAG) set(${NAME}_BINARY_DIR "${${LOWERCASE_NAME}_BINARY_DIR}" CACHE INTERNAL "") endfunction() -function(langulus_init_git_submodule NAME) - if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${NAME}/.git" ) - # Submodule hasn't been initialized yet, so call git submodule update --init on it - message(STATUS "Initializing submodule: ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}...") - find_package(Git REQUIRED) - execute_process( - COMMAND ${GIT_EXECUTABLE} submodule update --init -- ${NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND_ERROR_IS_FATAL ANY - ) - endif() -endfunction() - function(langulus_copy_dlls TARGET ON THIS) if(WIN32 AND LANGULUS_SHARED_LIBRARIES) add_custom_command( @@ -64,17 +51,4 @@ function(langulus_copy_dlls TARGET ON THIS) COMMAND_EXPAND_LISTS ) endif() -endfunction() - -function(langulus_copy_dlls_advanced THIS TO TARGET FROM) - if(WIN32) - add_dependencies(${TARGET} ${ARGN}) - foreach(element ${ARGN}) - add_custom_command( - TARGET ${THIS} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "$" "$" - COMMENT "Copying `$` to `$`" - ) - endforeach() - endif() endfunction() \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f9d65de..779cd21 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,9 +1,11 @@ -add_executable(LangulusFractallocTest - Main.cpp - TestAllocator.cpp - TestNewDelete.cpp +file(GLOB_RECURSE + LANGULUS_FRACTALLOC_TEST_SOURCES + LIST_DIRECTORIES FALSE CONFIGURE_DEPENDS + *.cpp *.hpp ) +add_executable(LangulusFractallocTest ${LANGULUS_FRACTALLOC_TEST_SOURCES}) + target_link_libraries(LangulusFractallocTest PRIVATE LangulusFractalloc Catch2