Skip to content

Commit

Permalink
action.yaml:
Browse files Browse the repository at this point in the history
- Run tests in parallel.

CMakeLists.txt:
- Remove TREE_GEN_BUILD_EMSCRIPTEN flag.
- FetchContent fmt instead of using the Conan package.
- Link against fmt::fmt-header-only
- Add C to the list of project languages.

conanfile.py:
- Remove the fmt dependency.
  • Loading branch information
rturrado committed Mar 18, 2024
1 parent 9dd5738 commit b7998bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/actions/cpp-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ runs:
- name: Test
working-directory: build/${{ inputs.build_type }}
run: |
ctest -C ${{ inputs.build_type }} --output-on-failure
ctest -C ${{ inputs.build_type }} --output-on-failure --parallel 10
shell: ${{ inputs.shell }}
29 changes: 10 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()

project(tree-gen LANGUAGES CXX)
project(tree-gen LANGUAGES C CXX)

# If tree-gen was already included elsewhere in the project, don't include it
# again. There should be only one place for it and one version per project.
Expand Down Expand Up @@ -83,12 +83,6 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# This sort of fixes that (https://stackoverflow.com/questions/1941443)
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# emscripten
if(TREE_GEN_BUILD_EMSCRIPTEN)
add_compile_options(-fwasm-exceptions)
add_link_options(-fwasm-exceptions --profiling-funcs -sASSERTIONS=1 -sMODULARIZE=1)
endif()


#=============================================================================#
# Package dependencies #
Expand All @@ -104,20 +98,17 @@ else()
endif()

# fmt
if(NOT TREE_GEN_BUILD_EMSCRIPTEN)
find_package(fmt)
endif()
if(TREE_GEN_BUILD_EMSCRIPTEN OR NOT fmt_FOUND)
FetchContent_Declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG "e69e5f977d458f2650bb346dadf2ad30c5320281"
)
FetchContent_MakeAvailable(fmt)
endif()
message(STATUS "Fetching fmt")
FetchContent_Declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG "e69e5f977d458f2650bb346dadf2ad30c5320281"
)
FetchContent_MakeAvailable(fmt)

# range-v3
find_package(range-v3)
if(NOT range-v3_FOUND)
message(STATUS "Fetching range-v3")
FetchContent_Declare(range-v3
GIT_REPOSITORY https://github.com/ericniebler/range-v3
GIT_TAG "a81477931a8aa2ad025c6bda0609f38e09e4d7ec"
Expand Down Expand Up @@ -155,7 +146,7 @@ target_include_directories(
PUBLIC ${TREE_GEN_LIB_PUBLIC_INCLUDE}
)
target_link_libraries(tree-gen-lib-obj
PRIVATE fmt::fmt
PRIVATE fmt::fmt-header-only
PRIVATE range-v3::range-v3
)

Expand Down Expand Up @@ -242,7 +233,7 @@ target_include_directories(tree-gen
)

target_link_libraries(tree-gen
PRIVATE fmt::fmt
PRIVATE fmt::fmt-header-only
PRIVATE range-v3::range-v3
)

Expand Down
2 changes: 0 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def build_requirements(self):
self.tool_requires("emsdk/3.1.49")

def requirements(self):
self.requires("fmt/10.2.1")
self.requires("range-v3/0.12.0")

def config_options(self):
Expand All @@ -85,7 +84,6 @@ def generate(self):
deps.generate()
tc = CMakeToolchain(self)
tc.variables["ASAN_ENABLED"] = self.options.asan_enabled
tc.variables["TREE_GEN_BUILD_EMSCRIPTEN"] = self.settings.arch == "wasm"
tc.variables["TREE_GEN_BUILD_TESTS"] = self.options.build_tests
tc.generate()

Expand Down

0 comments on commit b7998bb

Please sign in to comment.