Skip to content

Commit

Permalink
Removed repo dispatch; Externals built in build dir; CMake improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Epixu committed Oct 8, 2023
1 parent f83287e commit 724fd9a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Langulus::Fractalloc CI
on: [push, repository_dispatch]
on: push
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/dispatch.yml

This file was deleted.

6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
42 changes: 8 additions & 34 deletions LangulusUtilities.cmake
Original file line number Diff line number Diff line change
@@ -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})
Expand All @@ -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()

Expand All @@ -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})
Expand All @@ -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(
Expand All @@ -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 "$<TARGET_FILE:${element}>" "$<TARGET_FILE_DIR:${TARGET}>"
COMMENT "Copying `$<TARGET_FILE:${element}>` to `$<TARGET_FILE_DIR:${TARGET}>`"
)
endforeach()
endif()
endfunction()
10 changes: 6 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 724fd9a

Please sign in to comment.