diff --git a/AutoRAII.test/CMakeLists.txt b/AutoRAII.test/CMakeLists.txt new file mode 100644 index 0000000..b099603 --- /dev/null +++ b/AutoRAII.test/CMakeLists.txt @@ -0,0 +1 @@ +unit_test( 0 ) diff --git a/AutoRAII.test/Makefile b/AutoRAII.test/Makefile deleted file mode 100644 index b76123d..0000000 --- a/AutoRAII.test/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -CXXFLAGS+= -std=c++17 -I ../ - -all: 0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e78b67..286a012 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,29 @@ cmake_minimum_required( VERSION 3.25 ) project( Alepha ) -add_compile_options( -I . ; -std=c++20 ) +include( cmake/rules.cmake ) -set( VERBOSE 1 ) -set( CMAKE_VERBOSE_MAKEFILE true ) -file( CREATE_LINK ${CMAKE_SOURCE_DIR} Alepha SYMBOLIC ) -add_library( alepha SHARED Console.cpp ProgramOptions.cpp string_algorithms.cpp word_wrap.cpp ) +# The core alepha library: + +add_library( alepha SHARED + Console.cpp + ProgramOptions.cpp + string_algorithms.cpp + word_wrap.cpp +) +# Everything else depends upon it link_libraries( alepha ) +# The subdirs to build +add_subdirectory( Meta ) +add_subdirectory( Reflection ) + +# The local subdir tests to build +add_subdirectory( AutoRAII.test ) +add_subdirectory( comparisons.test ) +add_subdirectory( Exception.test ) + +# Sample applications add_executable( example example.cc ) diff --git a/Exception.test/CMakeLists.txt b/Exception.test/CMakeLists.txt new file mode 100644 index 0000000..c725ed7 --- /dev/null +++ b/Exception.test/CMakeLists.txt @@ -0,0 +1 @@ +unit_test( exception ) diff --git a/Exception.test/Makefile b/Exception.test/Makefile deleted file mode 100644 index d73a1b3..0000000 --- a/Exception.test/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -CXXFLAGS+= -std=c++2a -I ../ -CXXFLAGS+= -g -O0 -CXX=g++ - -CXXFLAGS+= -Wno-inline-namespace-reopened-noninline -CXXFLAGS+= -Wno-unused-comparison -CXXFLAGS+= -DAlepha=MyProject_Alepha - -all: exception diff --git a/Meta/CMakeLists.txt b/Meta/CMakeLists.txt new file mode 100644 index 0000000..e69eebb --- /dev/null +++ b/Meta/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( Meta.test ) diff --git a/Meta/Makefile b/Meta/Makefile deleted file mode 100644 index 3ec6ce7..0000000 --- a/Meta/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -CXXFLAGS+= -std=c++17 -I ../ - -all: test diff --git a/Meta/Meta.test/CMakeLists.txt b/Meta/Meta.test/CMakeLists.txt new file mode 100644 index 0000000..15040cf --- /dev/null +++ b/Meta/Meta.test/CMakeLists.txt @@ -0,0 +1 @@ +unit_test( traits ) diff --git a/Meta/test.cc b/Meta/Meta.test/traits.cc similarity index 100% rename from Meta/test.cc rename to Meta/Meta.test/traits.cc diff --git a/Reflection/CMakeLists.txt b/Reflection/CMakeLists.txt new file mode 100644 index 0000000..d124a33 --- /dev/null +++ b/Reflection/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( tuplizeAggregate.test ) diff --git a/Reflection/tuplizeAggregate.test/CMakeLists.txt b/Reflection/tuplizeAggregate.test/CMakeLists.txt new file mode 100644 index 0000000..b099603 --- /dev/null +++ b/Reflection/tuplizeAggregate.test/CMakeLists.txt @@ -0,0 +1 @@ +unit_test( 0 ) diff --git a/Reflection/tuplizeAggregate.test/Makefile b/Reflection/tuplizeAggregate.test/Makefile deleted file mode 100644 index 1f88709..0000000 --- a/Reflection/tuplizeAggregate.test/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -CXXFLAGS+= -std=c++17 -I . -CXXFLAGS+= -g -O0 - -all: 0 diff --git a/cmake/rules.cmake b/cmake/rules.cmake new file mode 100644 index 0000000..d98726d --- /dev/null +++ b/cmake/rules.cmake @@ -0,0 +1,27 @@ +#cmake_policy( SET CMP0002 OLD ) + +add_compile_options( -I ${CMAKE_BINARY_DIR} ; -std=c++20 ) + + +list( APPEND CMAKE_CTEST_ARGUMENTS "-VV" ) + + +set( VERBOSE 1 ) +set( CMAKE_VERBOSE_MAKEFILE true ) + +file( CREATE_LINK ${CMAKE_SOURCE_DIR} Alepha SYMBOLIC ) + + +include(CTest) + + +function( unit_test TEST_NAME ) + +get_filename_component( TEST_DOMAIN ${CMAKE_CURRENT_SOURCE_DIR} NAME ) +set( FULL_TEST_NAME ${TEST_DOMAIN}.${TEST_NAME} ) + +add_executable( ${FULL_TEST_NAME} ${TEST_NAME}.cc ) +add_test( ${FULL_TEST_NAME} ${FULL_TEST_NAME} ) + +endfunction( unit_test ) + diff --git a/comparisons.test/CMakeLists.txt b/comparisons.test/CMakeLists.txt new file mode 100644 index 0000000..b099603 --- /dev/null +++ b/comparisons.test/CMakeLists.txt @@ -0,0 +1 @@ +unit_test( 0 ) diff --git a/comparisons.test/Makefile b/comparisons.test/Makefile deleted file mode 100644 index cd954b9..0000000 --- a/comparisons.test/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -CXXFLAGS+= -std=c++17 -I ../ -CXXFLAGS+= -g -O0 - -all: 0