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 cdc3f0b commit 3314fbe
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 61 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::Logger 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.

4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ if (PROJECT_IS_TOP_LEVEL OR NOT LANGULUS)
include(LangulusUtilities.cmake)

# Add Langulus::Core library
fetch_langulus_module(Core)
fetch_langulus_module(Core GIT_TAG 39ae88b)
endif()

# Configure {fmt} library
fetch_external_module(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 5bdce18 # master branch
GIT_TAG 8e0ca05 # master branch
)

# Build and install Logger library
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 @@ -65,16 +52,3 @@ function(langulus_copy_dlls TARGET ON THIS)
)
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()
9 changes: 6 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
add_executable(LangulusLoggerTest
Main.cpp
TestLogger.cpp
file(GLOB_RECURSE
LANGULUS_LOGGER_TEST_SOURCES
LIST_DIRECTORIES FALSE CONFIGURE_DEPENDS
*.cpp *.hpp
)

add_executable(LangulusLoggerTest ${LANGULUS_LOGGER_TEST_SOURCES})

target_link_libraries(LangulusLoggerTest
PRIVATE LangulusLogger
Catch2
Expand Down

0 comments on commit 3314fbe

Please sign in to comment.