Skip to content

Commit

Permalink
fix(cmake): Clean up the CMake files
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieSams committed Oct 30, 2023
1 parent 5f07207 commit 822fa3c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 114 deletions.
16 changes: 2 additions & 14 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,10 @@
# limitations under the License.
##

include(SetSourceGroup)

SetSourceGroup(NAME Empty
PREFIX FTL_BENCHMARK
SOURCE_FILES empty/empty.cpp
)

SetSourceGroup(NAME "Producer Consumer"
PREFIX FTL_BENCHMARK
SOURCE_FILES producer_consumer/producer_consumer.cpp
)


set(FTL_BENCHMARK_SRC
${FTL_BENCHMARK_EMPTY}
${FTL_BENCHMARK_PRODUCER_CONSUMER}
empty/empty.cpp
producer_consumer/producer_consumer.cpp
)

# Set the c++ std
Expand Down
25 changes: 0 additions & 25 deletions cmake/SetSourceGroup.cmake

This file was deleted.

61 changes: 24 additions & 37 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# limitations under the License.
##

include(SetSourceGroup)
include(AddCompilerFlags)


Expand Down Expand Up @@ -62,44 +61,32 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(FTL_ARCH "arm64")
endif()

SetSourceGroup(NAME Core
PREFIX FTL
SOURCE_FILES
../include/ftl/task.h
../include/ftl/base_counter.h
base_counter.cpp
../include/ftl/atomic_counter.h
../include/ftl/task_counter.h
../include/ftl/task_scheduler.h
task_scheduler.cpp
set(FTL_SRC
../include/ftl/alloc.h
../include/ftl/assert.h
../include/ftl/atomic_counter.h
../include/ftl/base_counter.h
../include/ftl/callbacks.h
../include/ftl/config.h
../include/ftl/fiber.h
../include/ftl/fibtex.h
../include/ftl/ftl_valgrind.h
../include/ftl/ftl_valgrind.h
../include/ftl/parallel_for.h
../include/ftl/task_counter.h
../include/ftl/task_scheduler.h
../include/ftl/task.h
../include/ftl/thread_abstraction.h
../include/ftl/thread_local.h
../include/ftl/wait_free_queue.h
alloc.cpp
base_counter.cpp
fiber.cpp
task_scheduler.cpp
thread_abstraction.cpp
)

SetSourceGroup(NAME Util
PREFIX FTL
SOURCE_FILES ../include/ftl/alloc.h
alloc.cpp
../include/ftl/assert.h
../include/ftl/callbacks.h
../include/ftl/config.h
../include/ftl/fiber.h
fiber.cpp
../include/ftl/fibtex.h
../include/ftl/ftl_valgrind.h
../include/ftl/parallel_for.h
../include/ftl/thread_abstraction.h
thread_abstraction.cpp
../include/ftl/thread_local.h
../include/ftl/wait_free_queue.h
../include/ftl/ftl_valgrind.h
)

# Link all the sources into one
set(FIBER_TASKING_LIB_SRC
${FTL_CORE}
${FTL_UTIL}
)

add_library(ftl STATIC ${FIBER_TASKING_LIB_SRC})
add_library(ftl STATIC ${FTL_SRC})
target_compile_options(ftl PUBLIC -DNUM_WAITING_FIBER_SLOTS=${FTL_NUM_WAITING_FIBER_SLOTS})
target_include_directories(ftl PUBLIC ../include)
target_link_libraries(ftl boost_context ${CMAKE_THREAD_LIBS_INIT})
Expand Down
41 changes: 11 additions & 30 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,21 @@
# limitations under the License.
##

include(SetSourceGroup)
include(AddCompilerFlags)


SetSourceGroup(NAME "Fiber Abstraction"
PREFIX FTL_TEST
SOURCE_FILES fiber_abstraction/single_fiber_switch.cpp
fiber_abstraction/nested_fiber_switch.cpp
fiber_abstraction/floating_point_fiber_switch.cpp
)

SetSourceGroup(NAME "Functional"
PREFIX FTL_TEST
SOURCE_FILES functional/calc_triangle_num.cpp
functional/producer_consumer.cpp
)

SetSourceGroup(NAME "Utilities"
PREFIX FTL_TEST
SOURCE_FILES utilities/event_callbacks.cpp
utilities/fibtex.cpp
utilities/parallel_for.cpp
utilities/thread_local.cpp
)

# Link all the sources into one
set(FIBER_TASKING_LIB_TESTS_SRC
${FTL_TEST_FIBER_ABSTRACTION}
${FTL_TEST_FUNCTIONAL}
${FTL_TEST_UTILITIES}
set(FTL_TEST_SRC
fiber_abstraction/floating_point_fiber_switch.cpp
fiber_abstraction/nested_fiber_switch.cpp
fiber_abstraction/single_fiber_switch.cpp
utilities/event_callbacks.cpp
utilities/parallel_for.cpp
utilities/thread_local.cpp
functional/calc_triangle_num.cpp
functional/producer_consumer.cpp
utilities/fibtex.cpp
)


add_executable(ftl-test ${FIBER_TASKING_LIB_TESTS_SRC})
add_executable(ftl-test ${FTL_TEST_SRC})
target_link_libraries(ftl-test Catch2::Catch2WithMain ftl)

# Set the warnings
Expand Down
14 changes: 6 additions & 8 deletions third_party/boost_context/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
cmake_minimum_required(VERSION 3.2)
project(boost_context ASM)

include(SetSourceGroup)


option(FTL_FIBER_CANARY_BYTES "Enable canary bytes in fiber switching logic, to help debug errors" OFF)

Expand Down Expand Up @@ -94,11 +92,11 @@ message(STATUS "-- Target processor: ${CONTEXT_PLATFORM}")
message(STATUS "-- Target asm : ${CONTEXT_CANARY}${CONTEXT_PLATFORM}_${CONTEXT_OS}_${CONTEXT_ABI}_${CONTEXT_ASM}")


SetSourceGroup(NAME Root
PREFIX BOOST_CONTEXT
SOURCE_FILES asm/make_${CONTEXT_CANARY}${CONTEXT_PLATFORM}_${CONTEXT_OS}_${CONTEXT_ABI}_${CONTEXT_ASM}
asm/jump_${CONTEXT_CANARY}${CONTEXT_PLATFORM}_${CONTEXT_OS}_${CONTEXT_ABI}_${CONTEXT_ASM}
include/boost_context/fcontext.h)
set(BOOST_CONTEXT_SRC
asm/make_${CONTEXT_CANARY}${CONTEXT_PLATFORM}_${CONTEXT_OS}_${CONTEXT_ABI}_${CONTEXT_ASM}
asm/jump_${CONTEXT_CANARY}${CONTEXT_PLATFORM}_${CONTEXT_OS}_${CONTEXT_ABI}_${CONTEXT_ASM}
include/boost_context/fcontext.h
)

if (CONTEXT_ASM MATCHES "masm.asm" AND CONTEXT_PLATFORM MATCHES "i386")
set_source_files_properties(asm/make_${CONTEXT_PLATFORM}_${CONTEXT_OS}_${CONTEXT_ABI}_${CONTEXT_ASM}
Expand All @@ -107,5 +105,5 @@ if (CONTEXT_ASM MATCHES "masm.asm" AND CONTEXT_PLATFORM MATCHES "i386")
COMPILE_FLAGS "/safeseh")
endif()

add_library(boost_context STATIC ${BOOST_CONTEXT_ROOT})
add_library(boost_context STATIC ${BOOST_CONTEXT_SRC})
target_include_directories(boost_context INTERFACE include)

0 comments on commit 822fa3c

Please sign in to comment.