From 61463aa405ad3f0310944dac7ba88da30f3cb797 Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 16:39:03 +0100 Subject: [PATCH 01/10] Git: Use https link for cmake submodule. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 06c3765..69503ee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "cmake"] path = lib/cmake - url = git@github.com:OliverBenz/cmake_files.git + url = https://github.com/OliverBenz/cmake_files.git From 3c2102b516831bdc137f7124a359e3f2b9e9144f Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 16:39:16 +0100 Subject: [PATCH 02/10] Lib: Update Logger version. --- lib/logger.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logger.cmake b/lib/logger.cmake index 2e847a8..51b8f5a 100644 --- a/lib/logger.cmake +++ b/lib/logger.cmake @@ -5,7 +5,7 @@ include(FetchContent) FetchContent_Declare( Logger GIT_REPOSITORY https://github.com/OliverBenz/Logger.git - GIT_TAG 955d8c4f97b837af25c5da4ae28cb8ef1170e2ce + GIT_TAG 8e8f8e4a61c13ae370b5295775f92b14920bbc1a ) set(LOGGER_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(LOGGER_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) From 7847cd26ca5a6f6e9524af8822addb4eb090d87a Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 16:58:31 +0100 Subject: [PATCH 03/10] CMake: Setup ctest. --- CMakeLists.txt | 3 ++- tests/CMakeLists.txt | 2 -- tests/core/CMakeLists.txt | 3 ++- tests/gameNet/CMakeLists.txt | 3 ++- tests/network/CMakeLists.txt | 3 ++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdb901e..1798168 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,13 +11,14 @@ set(CMAKE_CXX_EXTENSIONS OFF) option(BUILD_TESTS "Create the unit tests for the project." True) option(BUILD_EXAMPLES "Create examples for the project." False) - # Add libraries to project add_subdirectory(lib) # Add source, tests and examples add_subdirectory(src) if(BUILD_TESTS) + include(CTest) + enable_testing() add_subdirectory(tests) endif() if(BUILD_EXAMPLES) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9b5880c..03a2d4c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,3 @@ -include(CTest) - add_subdirectory(core/) add_subdirectory(network/) add_subdirectory(gameNet/) \ No newline at end of file diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index 044b4f7..de7316b 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -17,4 +17,5 @@ set_compile_options(${targetName}) # Which extra compiler flags to enable set_output_directory(${targetName}) # Set the output directory of the library # Add tests -add_test(NAME ${targetName} COMMAND $) +include(GoogleTest) +gtest_discover_tests(${targetName}) \ No newline at end of file diff --git a/tests/gameNet/CMakeLists.txt b/tests/gameNet/CMakeLists.txt index 2eca52b..da89039 100644 --- a/tests/gameNet/CMakeLists.txt +++ b/tests/gameNet/CMakeLists.txt @@ -24,4 +24,5 @@ set_compile_options(${targetName}) # Which extra compiler flags to enable set_output_directory(${targetName}) # Set the output directory of the library # Add tests -add_test(NAME ${targetName} COMMAND $) +include(GoogleTest) +gtest_discover_tests(${targetName}) diff --git a/tests/network/CMakeLists.txt b/tests/network/CMakeLists.txt index b4a58f4..12f8426 100644 --- a/tests/network/CMakeLists.txt +++ b/tests/network/CMakeLists.txt @@ -16,4 +16,5 @@ set_compile_options(${targetName}) # Which extra compiler flags to enable set_output_directory(${targetName}) # Set the output directory of the library # Add tests -add_test(NAME ${targetName} COMMAND $) +include(GoogleTest) +gtest_discover_tests(${targetName}) \ No newline at end of file From 3ef5d81a0b48c6badfcdae47d3ee2e2553ab3874 Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 17:00:55 +0100 Subject: [PATCH 04/10] Scripts: Explicit parameters in buid script. --- scripts/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.sh b/scripts/build.sh index 7aa0ed2..bf72fb2 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,6 +5,6 @@ echo "Entering Development Environment" echo "Using configuration: $configuration" nix develop .. --command bash -c " - cmake -S .. -B ../build -DCMAKE_BUILD_TYPE=$configuration + cmake -S .. -B ../build -DCMAKE_BUILD_TYPE=$configuration -DBUILD_TESTS=True -DBUILD_EXAMPLES=True cmake --build ../build -j " \ No newline at end of file From 831b0193b0408af1de0426276689a2bca72507ff Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 17:01:11 +0100 Subject: [PATCH 05/10] Git: Setup workflow. --- .github/workflows/cmake.yml | 45 ++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f074e87..8263f2e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,6 +1,6 @@ name: CMake -on: [push] +on: [push, pull_request] env: BUILD_TYPE: Release @@ -10,28 +10,31 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Fetch git submodules - run: git submodule update --init --recursive - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Install Dependencies - run: sudo apt update; sudo apt install libgtest-dev - + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Nix + uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + experimental-features = nix-command flakes + - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: | + nix develop --command bash -c " + cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=True -DBUILD_EXAMPLES=True + " - name: Build - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake --build . --config $BUILD_TYPE + run: | + nix develop --command bash -c " + cmake --build build --config $BUILD_TYPE + " - name: Run Tests - working-directory: ${{runner.workspace}}/build - shell: bash - run: ./out/bin/Template.gtest + run: | + nix develop --command bash -c " + ctest --test-dir build --output-on-failure + " From 9da1900085e3205bff62fde9ecc192aaac22e88c Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 17:05:42 +0100 Subject: [PATCH 06/10] CMake: Minor improvements. --- .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 8 ++++---- scripts/build.sh | 2 +- src/CMakeLists.txt | 16 ++++++++-------- tests/CMakeLists.txt | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8263f2e..23ca590 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -24,7 +24,7 @@ jobs: - name: Configure CMake run: | nix develop --command bash -c " - cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=True -DBUILD_EXAMPLES=True + cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON " - name: Build diff --git a/CMakeLists.txt b/CMakeLists.txt index 1798168..4269e1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,8 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -option(BUILD_TESTS "Create the unit tests for the project." True) -option(BUILD_EXAMPLES "Create examples for the project." False) +option(BUILD_TESTS "Create the unit tests for the project." ON) +option(BUILD_EXAMPLES "Create examples for the project." OFF) # Add libraries to project add_subdirectory(lib) @@ -19,8 +19,8 @@ add_subdirectory(src) if(BUILD_TESTS) include(CTest) enable_testing() - add_subdirectory(tests) + add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/tests") endif() if(BUILD_EXAMPLES) - add_subdirectory(examples) + add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/examples") endif() diff --git a/scripts/build.sh b/scripts/build.sh index bf72fb2..4c2b8e1 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,6 +5,6 @@ echo "Entering Development Environment" echo "Using configuration: $configuration" nix develop .. --command bash -c " - cmake -S .. -B ../build -DCMAKE_BUILD_TYPE=$configuration -DBUILD_TESTS=True -DBUILD_EXAMPLES=True + cmake -S .. -B ../build -DCMAKE_BUILD_TYPE=$configuration -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON cmake --build ../build -j " \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f68fb4b..20cb951 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,9 @@ -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/libData/) # Library: Core data layer -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/libCore/) # Library: Core game logic -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/libNetwork/) # Library: Network layer networking -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/libGameNet/) # Library: Application layer networking -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/libCamera/) # Library: Physical board detection -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/libApp/) # Library: Application logic +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libData/") # Library: Core data layer +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libCore/") # Library: Core game logic +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libNetwork/") # Library: Network layer networking +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libGameNet/") # Library: Application layer networking +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libCamera/") # Library: Physical board detection +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libApp/") # Library: Application logic -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/gui/) # Application: GUI -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/server/) # Application: Server \ No newline at end of file +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/gui/") # Application: GUI +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/server/") # Application: Server \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 03a2d4c..7d6e6c1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,3 +1,3 @@ -add_subdirectory(core/) -add_subdirectory(network/) -add_subdirectory(gameNet/) \ No newline at end of file +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/core/") +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/network/") +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/gameNet/") \ No newline at end of file From 36e2749df7df885cf830906db5f64cda2c59ab5f Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 17:08:01 +0100 Subject: [PATCH 07/10] CMake: Fix there are no examples. --- .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 4 ---- scripts/build.sh | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 23ca590..fc510d6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -24,7 +24,7 @@ jobs: - name: Configure CMake run: | nix develop --command bash -c " - cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON + cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=ON " - name: Build diff --git a/CMakeLists.txt b/CMakeLists.txt index 4269e1b..80f3222 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) option(BUILD_TESTS "Create the unit tests for the project." ON) -option(BUILD_EXAMPLES "Create examples for the project." OFF) # Add libraries to project add_subdirectory(lib) @@ -21,6 +20,3 @@ if(BUILD_TESTS) enable_testing() add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/tests") endif() -if(BUILD_EXAMPLES) - add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/examples") -endif() diff --git a/scripts/build.sh b/scripts/build.sh index 4c2b8e1..f1473d0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,6 +5,6 @@ echo "Entering Development Environment" echo "Using configuration: $configuration" nix develop .. --command bash -c " - cmake -S .. -B ../build -DCMAKE_BUILD_TYPE=$configuration -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON + cmake -S .. -B ../build -DCMAKE_BUILD_TYPE=$configuration -DBUILD_TESTS=ON cmake --build ../build -j " \ No newline at end of file From 7a7e13e87d46c0a313a1313528c3636a502da6e4 Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 17:10:33 +0100 Subject: [PATCH 08/10] Git: Build Debug for CI. --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index fc510d6..ef47f70 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -3,7 +3,7 @@ name: CMake on: [push, pull_request] env: - BUILD_TYPE: Release + BUILD_TYPE: Debug jobs: Build_And_Test: From 0802dbf7de36b845eef7e95587211d0353d935cb Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 17:22:06 +0100 Subject: [PATCH 09/10] CMake: Rename projects and protect paths. --- CMakeLists.txt | 4 +- src/App/CMakeLists.txt | 43 ++++++++++++++++ src/{libApp => App}/Logging.cpp | 0 src/{libApp => App}/Logging.hpp | 0 src/{libApp => App}/eventHub.cpp | 0 src/{libApp => App}/gameServer.cpp | 0 .../include/app/IAppSignalListener.hpp | 0 src/{libApp => App}/include/app/eventHub.hpp | 0 .../include/app/gameServer.hpp | 0 src/{libApp => App}/include/app/position.hpp | 0 .../include/app/sessionManager.hpp | 0 src/{libApp => App}/position.cpp | 0 src/{libApp => App}/sessionManager.cpp | 0 src/CMakeLists.txt | 12 ++--- src/{libCamera => Camera}/BoardDetect.cpp | 0 src/{libCamera => Camera}/BoardDetect.hpp | 0 src/{libCamera => Camera}/CMakeLists.txt | 4 +- src/{libCamera => Camera}/main.cpp | 0 src/Core/CMakeLists.txt | 49 +++++++++++++++++++ src/{libCore => Core}/README.md | 0 src/{libCore => Core}/eventHub.cpp | 0 src/{libCore => Core}/game.cpp | 0 .../include/core/IGameSignalListener.hpp | 0 .../include/core/IGameStateListener.hpp | 0 .../include/core/IZobristHash.hpp | 0 .../include/core/SafeQueue.hpp | 0 .../include/core/eventHub.hpp | 0 src/{libCore => Core}/include/core/game.hpp | 0 .../include/core/gameEvent.hpp | 0 .../include/core/moveChecker.hpp | 0 .../include/core/position.hpp | 0 .../include/core/sgfHandler.hpp | 0 src/{libCore => Core}/moveChecker.cpp | 0 src/{libCore => Core}/position.cpp | 0 src/{libCore => Core}/sgfHandler.cpp | 0 src/{libCore => Core}/zobristHash.hpp | 0 src/{libData => Data}/CMakeLists.txt | 14 +++--- src/{libData => Data}/board.cpp | 0 src/{libData => Data}/include/data/board.hpp | 0 .../include/data/coordinate.hpp | 0 .../include/data/gameStatus.hpp | 0 src/{libData => Data}/include/data/player.hpp | 0 src/GameNet/CMakeLists.txt | 43 ++++++++++++++++ src/{libGameNet => GameNet}/README.md | 0 src/{libGameNet => GameNet}/SafeQueue.hpp | 0 src/{libGameNet => GameNet}/client.cpp | 0 .../include/gameNet/client.hpp | 0 .../include/gameNet/nwEvents.hpp | 0 .../include/gameNet/server.hpp | 0 .../include/gameNet/types.hpp | 0 src/{libGameNet => GameNet}/nwEvents.cpp | 0 src/{libGameNet => GameNet}/server.cpp | 0 src/{libGameNet => GameNet}/serverEvents.hpp | 0 .../sessionManager.cpp | 0 .../sessionManager.hpp | 0 src/Network/CMakeLists.txt | 37 ++++++++++++++ src/{libNetwork => Network}/README.md | 0 src/{libNetwork => Network}/connection.cpp | 0 src/{libNetwork => Network}/connection.hpp | 0 .../include/network/protocol.hpp | 0 .../include/network/tcpClient.hpp | 0 .../include/network/tcpServer.hpp | 0 src/{libNetwork => Network}/tcpClient.cpp | 0 src/{libNetwork => Network}/tcpServer.cpp | 0 src/libApp/CMakeLists.txt | 43 ---------------- src/libCore/CMakeLists.txt | 49 ------------------- src/libGameNet/CMakeLists.txt | 43 ---------------- src/libNetwork/CMakeLists.txt | 37 -------------- tests/core/CMakeLists.txt | 4 +- tests/gameNet/CMakeLists.txt | 8 +-- tests/network/CMakeLists.txt | 2 +- 71 files changed, 196 insertions(+), 196 deletions(-) create mode 100644 src/App/CMakeLists.txt rename src/{libApp => App}/Logging.cpp (100%) rename src/{libApp => App}/Logging.hpp (100%) rename src/{libApp => App}/eventHub.cpp (100%) rename src/{libApp => App}/gameServer.cpp (100%) rename src/{libApp => App}/include/app/IAppSignalListener.hpp (100%) rename src/{libApp => App}/include/app/eventHub.hpp (100%) rename src/{libApp => App}/include/app/gameServer.hpp (100%) rename src/{libApp => App}/include/app/position.hpp (100%) rename src/{libApp => App}/include/app/sessionManager.hpp (100%) rename src/{libApp => App}/position.cpp (100%) rename src/{libApp => App}/sessionManager.cpp (100%) rename src/{libCamera => Camera}/BoardDetect.cpp (100%) rename src/{libCamera => Camera}/BoardDetect.hpp (100%) rename src/{libCamera => Camera}/CMakeLists.txt (92%) rename src/{libCamera => Camera}/main.cpp (100%) create mode 100644 src/Core/CMakeLists.txt rename src/{libCore => Core}/README.md (100%) rename src/{libCore => Core}/eventHub.cpp (100%) rename src/{libCore => Core}/game.cpp (100%) rename src/{libCore => Core}/include/core/IGameSignalListener.hpp (100%) rename src/{libCore => Core}/include/core/IGameStateListener.hpp (100%) rename src/{libCore => Core}/include/core/IZobristHash.hpp (100%) rename src/{libCore => Core}/include/core/SafeQueue.hpp (100%) rename src/{libCore => Core}/include/core/eventHub.hpp (100%) rename src/{libCore => Core}/include/core/game.hpp (100%) rename src/{libCore => Core}/include/core/gameEvent.hpp (100%) rename src/{libCore => Core}/include/core/moveChecker.hpp (100%) rename src/{libCore => Core}/include/core/position.hpp (100%) rename src/{libCore => Core}/include/core/sgfHandler.hpp (100%) rename src/{libCore => Core}/moveChecker.cpp (100%) rename src/{libCore => Core}/position.cpp (100%) rename src/{libCore => Core}/sgfHandler.cpp (100%) rename src/{libCore => Core}/zobristHash.hpp (100%) rename src/{libData => Data}/CMakeLists.txt (58%) rename src/{libData => Data}/board.cpp (100%) rename src/{libData => Data}/include/data/board.hpp (100%) rename src/{libData => Data}/include/data/coordinate.hpp (100%) rename src/{libData => Data}/include/data/gameStatus.hpp (100%) rename src/{libData => Data}/include/data/player.hpp (100%) create mode 100644 src/GameNet/CMakeLists.txt rename src/{libGameNet => GameNet}/README.md (100%) rename src/{libGameNet => GameNet}/SafeQueue.hpp (100%) rename src/{libGameNet => GameNet}/client.cpp (100%) rename src/{libGameNet => GameNet}/include/gameNet/client.hpp (100%) rename src/{libGameNet => GameNet}/include/gameNet/nwEvents.hpp (100%) rename src/{libGameNet => GameNet}/include/gameNet/server.hpp (100%) rename src/{libGameNet => GameNet}/include/gameNet/types.hpp (100%) rename src/{libGameNet => GameNet}/nwEvents.cpp (100%) rename src/{libGameNet => GameNet}/server.cpp (100%) rename src/{libGameNet => GameNet}/serverEvents.hpp (100%) rename src/{libGameNet => GameNet}/sessionManager.cpp (100%) rename src/{libGameNet => GameNet}/sessionManager.hpp (100%) create mode 100644 src/Network/CMakeLists.txt rename src/{libNetwork => Network}/README.md (100%) rename src/{libNetwork => Network}/connection.cpp (100%) rename src/{libNetwork => Network}/connection.hpp (100%) rename src/{libNetwork => Network}/include/network/protocol.hpp (100%) rename src/{libNetwork => Network}/include/network/tcpClient.hpp (100%) rename src/{libNetwork => Network}/include/network/tcpServer.hpp (100%) rename src/{libNetwork => Network}/tcpClient.cpp (100%) rename src/{libNetwork => Network}/tcpServer.cpp (100%) delete mode 100644 src/libApp/CMakeLists.txt delete mode 100644 src/libCore/CMakeLists.txt delete mode 100644 src/libGameNet/CMakeLists.txt delete mode 100644 src/libNetwork/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 80f3222..fef7f8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,10 +11,10 @@ set(CMAKE_CXX_EXTENSIONS OFF) option(BUILD_TESTS "Create the unit tests for the project." ON) # Add libraries to project -add_subdirectory(lib) +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/lib") # Add source, tests and examples -add_subdirectory(src) +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/src") if(BUILD_TESTS) include(CTest) enable_testing() diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt new file mode 100644 index 0000000..8d35c2f --- /dev/null +++ b/src/App/CMakeLists.txt @@ -0,0 +1,43 @@ +# Settings +set(targetName App) + +# Get files to build +set(headers + "${CMAKE_CURRENT_LIST_DIR}/include/app/sessionManager.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/app/IAppSignalListener.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/app/eventHub.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/app/position.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/app/gameServer.hpp" + "${CMAKE_CURRENT_LIST_DIR}/Logging.hpp" +) + +set(sources + "${CMAKE_CURRENT_LIST_DIR}/sessionManager.cpp" + "${CMAKE_CURRENT_LIST_DIR}/eventHub.cpp" + "${CMAKE_CURRENT_LIST_DIR}/position.cpp" + "${CMAKE_CURRENT_LIST_DIR}/gameServer.cpp" + "${CMAKE_CURRENT_LIST_DIR}/Logging.cpp" +) + +add_library(${targetName} STATIC + ${headers} ${sources} +) +add_library(go::app ALIAS ${targetName}) + +target_include_directories(${targetName} + PUBLIC + "${CMAKE_CURRENT_LIST_DIR}/include" +) + +# TODO: GameNet should be private. +target_link_libraries(${targetName} + PRIVATE + Logger::Logger + PUBLIC + go::core go::gameNet +) + +# Setup project settings +set_project_warnings(${targetName}) +set_compile_options(${targetName}) +set_output_directory(${targetName}) diff --git a/src/libApp/Logging.cpp b/src/App/Logging.cpp similarity index 100% rename from src/libApp/Logging.cpp rename to src/App/Logging.cpp diff --git a/src/libApp/Logging.hpp b/src/App/Logging.hpp similarity index 100% rename from src/libApp/Logging.hpp rename to src/App/Logging.hpp diff --git a/src/libApp/eventHub.cpp b/src/App/eventHub.cpp similarity index 100% rename from src/libApp/eventHub.cpp rename to src/App/eventHub.cpp diff --git a/src/libApp/gameServer.cpp b/src/App/gameServer.cpp similarity index 100% rename from src/libApp/gameServer.cpp rename to src/App/gameServer.cpp diff --git a/src/libApp/include/app/IAppSignalListener.hpp b/src/App/include/app/IAppSignalListener.hpp similarity index 100% rename from src/libApp/include/app/IAppSignalListener.hpp rename to src/App/include/app/IAppSignalListener.hpp diff --git a/src/libApp/include/app/eventHub.hpp b/src/App/include/app/eventHub.hpp similarity index 100% rename from src/libApp/include/app/eventHub.hpp rename to src/App/include/app/eventHub.hpp diff --git a/src/libApp/include/app/gameServer.hpp b/src/App/include/app/gameServer.hpp similarity index 100% rename from src/libApp/include/app/gameServer.hpp rename to src/App/include/app/gameServer.hpp diff --git a/src/libApp/include/app/position.hpp b/src/App/include/app/position.hpp similarity index 100% rename from src/libApp/include/app/position.hpp rename to src/App/include/app/position.hpp diff --git a/src/libApp/include/app/sessionManager.hpp b/src/App/include/app/sessionManager.hpp similarity index 100% rename from src/libApp/include/app/sessionManager.hpp rename to src/App/include/app/sessionManager.hpp diff --git a/src/libApp/position.cpp b/src/App/position.cpp similarity index 100% rename from src/libApp/position.cpp rename to src/App/position.cpp diff --git a/src/libApp/sessionManager.cpp b/src/App/sessionManager.cpp similarity index 100% rename from src/libApp/sessionManager.cpp rename to src/App/sessionManager.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 20cb951..6b419a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,9 @@ -add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libData/") # Library: Core data layer -add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libCore/") # Library: Core game logic -add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libNetwork/") # Library: Network layer networking -add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libGameNet/") # Library: Application layer networking -add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libCamera/") # Library: Physical board detection -add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libApp/") # Library: Application logic +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Data/") # Library: Core data layer +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Core/") # Library: Core game logic +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Network/") # Library: Network layer networking +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/GameNet/") # Library: Application layer networking +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Camera/") # Library: Physical board detection +add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/App/") # Library: Application logic add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/gui/") # Application: GUI add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/server/") # Application: Server \ No newline at end of file diff --git a/src/libCamera/BoardDetect.cpp b/src/Camera/BoardDetect.cpp similarity index 100% rename from src/libCamera/BoardDetect.cpp rename to src/Camera/BoardDetect.cpp diff --git a/src/libCamera/BoardDetect.hpp b/src/Camera/BoardDetect.hpp similarity index 100% rename from src/libCamera/BoardDetect.hpp rename to src/Camera/BoardDetect.hpp diff --git a/src/libCamera/CMakeLists.txt b/src/Camera/CMakeLists.txt similarity index 92% rename from src/libCamera/CMakeLists.txt rename to src/Camera/CMakeLists.txt index 8e0633e..a1f0a37 100644 --- a/src/libCamera/CMakeLists.txt +++ b/src/Camera/CMakeLists.txt @@ -1,11 +1,11 @@ # Settings -set(targetName libCamera) +set(targetName Camera) find_package(OpenCV REQUIRED) # Get files to build set(headers ) -set(sources ${CMAKE_CURRENT_LIST_DIR}/main.cpp) +set(sources "${CMAKE_CURRENT_LIST_DIR}/main.cpp") # TODO: This core/ will be a library. Not the executable. # Create target diff --git a/src/libCamera/main.cpp b/src/Camera/main.cpp similarity index 100% rename from src/libCamera/main.cpp rename to src/Camera/main.cpp diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt new file mode 100644 index 0000000..3304a68 --- /dev/null +++ b/src/Core/CMakeLists.txt @@ -0,0 +1,49 @@ +# Settings +set(targetName Core) + +# Get files to build +set(headers + "${CMAKE_CURRENT_LIST_DIR}/include/core/game.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/position.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/gameEvent.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/IGameStateListener.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/IGameSignalListener.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/SafeQueue.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/sgfHandler.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/moveChecker.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/core/eventHub.hpp" + "${CMAKE_CURRENT_LIST_DIR}/zobristHash.hpp" +) +set(sources + "${CMAKE_CURRENT_LIST_DIR}/position.cpp" + "${CMAKE_CURRENT_LIST_DIR}/game.cpp" + "${CMAKE_CURRENT_LIST_DIR}/sgfHandler.cpp" + "${CMAKE_CURRENT_LIST_DIR}/moveChecker.cpp" + "${CMAKE_CURRENT_LIST_DIR}/eventHub.cpp" +) + +# Create target +add_library(${targetName} STATIC + ${headers} + ${sources} +) +add_library(go::core ALIAS ${targetName}) + +target_include_directories(${targetName} + PUBLIC + "${CMAKE_CURRENT_LIST_DIR}/include" +) +target_link_libraries(${targetName} + PUBLIC + go::data +) + +# Setup project settings +set_project_warnings(${targetName}) # Which warnings to enable +set_compile_options(${targetName}) # Which extra compiler flags to enable +set_output_directory(${targetName}) # Set the output directory of the library + +# Specify version +target_compile_definitions(${targetName} PUBLIC VERSION_MAJOR=0) +target_compile_definitions(${targetName} PUBLIC VERSION_MINOR=0) +target_compile_definitions(${targetName} PUBLIC VERSION_PATCH=1) diff --git a/src/libCore/README.md b/src/Core/README.md similarity index 100% rename from src/libCore/README.md rename to src/Core/README.md diff --git a/src/libCore/eventHub.cpp b/src/Core/eventHub.cpp similarity index 100% rename from src/libCore/eventHub.cpp rename to src/Core/eventHub.cpp diff --git a/src/libCore/game.cpp b/src/Core/game.cpp similarity index 100% rename from src/libCore/game.cpp rename to src/Core/game.cpp diff --git a/src/libCore/include/core/IGameSignalListener.hpp b/src/Core/include/core/IGameSignalListener.hpp similarity index 100% rename from src/libCore/include/core/IGameSignalListener.hpp rename to src/Core/include/core/IGameSignalListener.hpp diff --git a/src/libCore/include/core/IGameStateListener.hpp b/src/Core/include/core/IGameStateListener.hpp similarity index 100% rename from src/libCore/include/core/IGameStateListener.hpp rename to src/Core/include/core/IGameStateListener.hpp diff --git a/src/libCore/include/core/IZobristHash.hpp b/src/Core/include/core/IZobristHash.hpp similarity index 100% rename from src/libCore/include/core/IZobristHash.hpp rename to src/Core/include/core/IZobristHash.hpp diff --git a/src/libCore/include/core/SafeQueue.hpp b/src/Core/include/core/SafeQueue.hpp similarity index 100% rename from src/libCore/include/core/SafeQueue.hpp rename to src/Core/include/core/SafeQueue.hpp diff --git a/src/libCore/include/core/eventHub.hpp b/src/Core/include/core/eventHub.hpp similarity index 100% rename from src/libCore/include/core/eventHub.hpp rename to src/Core/include/core/eventHub.hpp diff --git a/src/libCore/include/core/game.hpp b/src/Core/include/core/game.hpp similarity index 100% rename from src/libCore/include/core/game.hpp rename to src/Core/include/core/game.hpp diff --git a/src/libCore/include/core/gameEvent.hpp b/src/Core/include/core/gameEvent.hpp similarity index 100% rename from src/libCore/include/core/gameEvent.hpp rename to src/Core/include/core/gameEvent.hpp diff --git a/src/libCore/include/core/moveChecker.hpp b/src/Core/include/core/moveChecker.hpp similarity index 100% rename from src/libCore/include/core/moveChecker.hpp rename to src/Core/include/core/moveChecker.hpp diff --git a/src/libCore/include/core/position.hpp b/src/Core/include/core/position.hpp similarity index 100% rename from src/libCore/include/core/position.hpp rename to src/Core/include/core/position.hpp diff --git a/src/libCore/include/core/sgfHandler.hpp b/src/Core/include/core/sgfHandler.hpp similarity index 100% rename from src/libCore/include/core/sgfHandler.hpp rename to src/Core/include/core/sgfHandler.hpp diff --git a/src/libCore/moveChecker.cpp b/src/Core/moveChecker.cpp similarity index 100% rename from src/libCore/moveChecker.cpp rename to src/Core/moveChecker.cpp diff --git a/src/libCore/position.cpp b/src/Core/position.cpp similarity index 100% rename from src/libCore/position.cpp rename to src/Core/position.cpp diff --git a/src/libCore/sgfHandler.cpp b/src/Core/sgfHandler.cpp similarity index 100% rename from src/libCore/sgfHandler.cpp rename to src/Core/sgfHandler.cpp diff --git a/src/libCore/zobristHash.hpp b/src/Core/zobristHash.hpp similarity index 100% rename from src/libCore/zobristHash.hpp rename to src/Core/zobristHash.hpp diff --git a/src/libData/CMakeLists.txt b/src/Data/CMakeLists.txt similarity index 58% rename from src/libData/CMakeLists.txt rename to src/Data/CMakeLists.txt index 561a001..84df158 100644 --- a/src/libData/CMakeLists.txt +++ b/src/Data/CMakeLists.txt @@ -1,15 +1,15 @@ # Settings -set(targetName libData) +set(targetName Data) # Get files to build set(headers - ${CMAKE_CURRENT_LIST_DIR}/include/data/player.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/data/coordinate.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/data/board.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/data/gameStatus.hpp + "${CMAKE_CURRENT_LIST_DIR}/include/data/player.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/data/coordinate.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/data/board.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/data/gameStatus.hpp" ) set(sources - ${CMAKE_CURRENT_LIST_DIR}/board.cpp + "${CMAKE_CURRENT_LIST_DIR}/board.cpp" ) # Create target @@ -18,7 +18,7 @@ add_library(go::data ALIAS ${targetName}) target_include_directories(${targetName} PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + "${CMAKE_CURRENT_LIST_DIR}/include" ) # Setup project settings diff --git a/src/libData/board.cpp b/src/Data/board.cpp similarity index 100% rename from src/libData/board.cpp rename to src/Data/board.cpp diff --git a/src/libData/include/data/board.hpp b/src/Data/include/data/board.hpp similarity index 100% rename from src/libData/include/data/board.hpp rename to src/Data/include/data/board.hpp diff --git a/src/libData/include/data/coordinate.hpp b/src/Data/include/data/coordinate.hpp similarity index 100% rename from src/libData/include/data/coordinate.hpp rename to src/Data/include/data/coordinate.hpp diff --git a/src/libData/include/data/gameStatus.hpp b/src/Data/include/data/gameStatus.hpp similarity index 100% rename from src/libData/include/data/gameStatus.hpp rename to src/Data/include/data/gameStatus.hpp diff --git a/src/libData/include/data/player.hpp b/src/Data/include/data/player.hpp similarity index 100% rename from src/libData/include/data/player.hpp rename to src/Data/include/data/player.hpp diff --git a/src/GameNet/CMakeLists.txt b/src/GameNet/CMakeLists.txt new file mode 100644 index 0000000..9a94935 --- /dev/null +++ b/src/GameNet/CMakeLists.txt @@ -0,0 +1,43 @@ +# Settings +set(targetName GameNet) + +# Get files to build +set(headers + "${CMAKE_CURRENT_LIST_DIR}/include/gameNet/client.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/gameNet/server.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/gameNet/nwEvents.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/gameNet/types.hpp" + "${CMAKE_CURRENT_LIST_DIR}/sessionManager.hpp" + "${CMAKE_CURRENT_LIST_DIR}/serverEvents.hpp" +) + +set(sources + "${CMAKE_CURRENT_LIST_DIR}/client.cpp" + "${CMAKE_CURRENT_LIST_DIR}/server.cpp" + "${CMAKE_CURRENT_LIST_DIR}/nwEvents.cpp" + "${CMAKE_CURRENT_LIST_DIR}/sessionManager.cpp" +) + + +add_library(${targetName} STATIC + ${headers} ${sources} +) +add_library(go::gameNet ALIAS ${targetName}) + +target_include_directories(${targetName} + PUBLIC + "${CMAKE_CURRENT_LIST_DIR}/include" +) + +target_link_libraries(${targetName} + PUBLIC + go::data + PRIVATE + go::network + nlohmann_json::nlohmann_json +) + +# Setup project settings +set_project_warnings(${targetName}) +set_compile_options(${targetName}) +set_output_directory(${targetName}) diff --git a/src/libGameNet/README.md b/src/GameNet/README.md similarity index 100% rename from src/libGameNet/README.md rename to src/GameNet/README.md diff --git a/src/libGameNet/SafeQueue.hpp b/src/GameNet/SafeQueue.hpp similarity index 100% rename from src/libGameNet/SafeQueue.hpp rename to src/GameNet/SafeQueue.hpp diff --git a/src/libGameNet/client.cpp b/src/GameNet/client.cpp similarity index 100% rename from src/libGameNet/client.cpp rename to src/GameNet/client.cpp diff --git a/src/libGameNet/include/gameNet/client.hpp b/src/GameNet/include/gameNet/client.hpp similarity index 100% rename from src/libGameNet/include/gameNet/client.hpp rename to src/GameNet/include/gameNet/client.hpp diff --git a/src/libGameNet/include/gameNet/nwEvents.hpp b/src/GameNet/include/gameNet/nwEvents.hpp similarity index 100% rename from src/libGameNet/include/gameNet/nwEvents.hpp rename to src/GameNet/include/gameNet/nwEvents.hpp diff --git a/src/libGameNet/include/gameNet/server.hpp b/src/GameNet/include/gameNet/server.hpp similarity index 100% rename from src/libGameNet/include/gameNet/server.hpp rename to src/GameNet/include/gameNet/server.hpp diff --git a/src/libGameNet/include/gameNet/types.hpp b/src/GameNet/include/gameNet/types.hpp similarity index 100% rename from src/libGameNet/include/gameNet/types.hpp rename to src/GameNet/include/gameNet/types.hpp diff --git a/src/libGameNet/nwEvents.cpp b/src/GameNet/nwEvents.cpp similarity index 100% rename from src/libGameNet/nwEvents.cpp rename to src/GameNet/nwEvents.cpp diff --git a/src/libGameNet/server.cpp b/src/GameNet/server.cpp similarity index 100% rename from src/libGameNet/server.cpp rename to src/GameNet/server.cpp diff --git a/src/libGameNet/serverEvents.hpp b/src/GameNet/serverEvents.hpp similarity index 100% rename from src/libGameNet/serverEvents.hpp rename to src/GameNet/serverEvents.hpp diff --git a/src/libGameNet/sessionManager.cpp b/src/GameNet/sessionManager.cpp similarity index 100% rename from src/libGameNet/sessionManager.cpp rename to src/GameNet/sessionManager.cpp diff --git a/src/libGameNet/sessionManager.hpp b/src/GameNet/sessionManager.hpp similarity index 100% rename from src/libGameNet/sessionManager.hpp rename to src/GameNet/sessionManager.hpp diff --git a/src/Network/CMakeLists.txt b/src/Network/CMakeLists.txt new file mode 100644 index 0000000..5961b8f --- /dev/null +++ b/src/Network/CMakeLists.txt @@ -0,0 +1,37 @@ +# Settings +set(targetName Network) + +# Get files to build +set(headers + "${CMAKE_CURRENT_LIST_DIR}/include/network/protocol.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/network/tcpServer.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/network/tcpClient.hpp" + "${CMAKE_CURRENT_LIST_DIR}/connection.hpp" +) + +set(sources + "${CMAKE_CURRENT_LIST_DIR}/tcpServer.cpp" + "${CMAKE_CURRENT_LIST_DIR}/tcpClient.cpp" + "${CMAKE_CURRENT_LIST_DIR}/connection.cpp" +) + + +add_library(${targetName} STATIC + ${headers} ${sources} +) +add_library(go::network ALIAS ${targetName}) + +target_include_directories(${targetName} + PUBLIC + "${CMAKE_CURRENT_LIST_DIR}/include" +) + +target_link_libraries(${targetName} + PRIVATE + asio +) + +# Setup project settings +set_project_warnings(${targetName}) +set_compile_options(${targetName}) +set_output_directory(${targetName}) diff --git a/src/libNetwork/README.md b/src/Network/README.md similarity index 100% rename from src/libNetwork/README.md rename to src/Network/README.md diff --git a/src/libNetwork/connection.cpp b/src/Network/connection.cpp similarity index 100% rename from src/libNetwork/connection.cpp rename to src/Network/connection.cpp diff --git a/src/libNetwork/connection.hpp b/src/Network/connection.hpp similarity index 100% rename from src/libNetwork/connection.hpp rename to src/Network/connection.hpp diff --git a/src/libNetwork/include/network/protocol.hpp b/src/Network/include/network/protocol.hpp similarity index 100% rename from src/libNetwork/include/network/protocol.hpp rename to src/Network/include/network/protocol.hpp diff --git a/src/libNetwork/include/network/tcpClient.hpp b/src/Network/include/network/tcpClient.hpp similarity index 100% rename from src/libNetwork/include/network/tcpClient.hpp rename to src/Network/include/network/tcpClient.hpp diff --git a/src/libNetwork/include/network/tcpServer.hpp b/src/Network/include/network/tcpServer.hpp similarity index 100% rename from src/libNetwork/include/network/tcpServer.hpp rename to src/Network/include/network/tcpServer.hpp diff --git a/src/libNetwork/tcpClient.cpp b/src/Network/tcpClient.cpp similarity index 100% rename from src/libNetwork/tcpClient.cpp rename to src/Network/tcpClient.cpp diff --git a/src/libNetwork/tcpServer.cpp b/src/Network/tcpServer.cpp similarity index 100% rename from src/libNetwork/tcpServer.cpp rename to src/Network/tcpServer.cpp diff --git a/src/libApp/CMakeLists.txt b/src/libApp/CMakeLists.txt deleted file mode 100644 index b632a42..0000000 --- a/src/libApp/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Settings -set(targetName libApp) - -# Get files to build -set(headers - ${CMAKE_CURRENT_LIST_DIR}/include/app/sessionManager.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/app/IAppSignalListener.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/app/eventHub.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/app/position.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/app/gameServer.hpp - ${CMAKE_CURRENT_LIST_DIR}/Logging.hpp -) - -set(sources - ${CMAKE_CURRENT_LIST_DIR}/sessionManager.cpp - ${CMAKE_CURRENT_LIST_DIR}/eventHub.cpp - ${CMAKE_CURRENT_LIST_DIR}/position.cpp - ${CMAKE_CURRENT_LIST_DIR}/gameServer.cpp - ${CMAKE_CURRENT_LIST_DIR}/Logging.cpp -) - -add_library(${targetName} STATIC - ${headers} ${sources} -) -add_library(go::app ALIAS ${targetName}) - -target_include_directories(${targetName} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include -) - -# TODO: GameNet should be private. -target_link_libraries(${targetName} - PRIVATE - Logger::Logger - PUBLIC - go::core go::gameNet -) - -# Setup project settings -set_project_warnings(${targetName}) -set_compile_options(${targetName}) -set_output_directory(${targetName}) diff --git a/src/libCore/CMakeLists.txt b/src/libCore/CMakeLists.txt deleted file mode 100644 index 54dba8f..0000000 --- a/src/libCore/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Settings -set(targetName libCore) - -# Get files to build -set(headers - ${CMAKE_CURRENT_LIST_DIR}/include/core/game.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/position.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/gameEvent.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/IGameStateListener.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/IGameSignalListener.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/SafeQueue.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/sgfHandler.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/moveChecker.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/core/eventHub.hpp - ${CMAKE_CURRENT_LIST_DIR}/zobristHash.hpp -) -set(sources - ${CMAKE_CURRENT_LIST_DIR}/position.cpp - ${CMAKE_CURRENT_LIST_DIR}/game.cpp - ${CMAKE_CURRENT_LIST_DIR}/sgfHandler.cpp - ${CMAKE_CURRENT_LIST_DIR}/moveChecker.cpp - ${CMAKE_CURRENT_LIST_DIR}/eventHub.cpp -) - -# Create target -add_library(${targetName} STATIC - ${headers} - ${sources} -) -add_library(go::core ALIAS ${targetName}) - -target_include_directories(${targetName} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include -) -target_link_libraries(${targetName} - PUBLIC - go::data -) - -# Setup project settings -set_project_warnings(${targetName}) # Which warnings to enable -set_compile_options(${targetName}) # Which extra compiler flags to enable -set_output_directory(${targetName}) # Set the output directory of the library - -# Specify version -target_compile_definitions(${targetName} PUBLIC VERSION_MAJOR=0) -target_compile_definitions(${targetName} PUBLIC VERSION_MINOR=0) -target_compile_definitions(${targetName} PUBLIC VERSION_PATCH=1) diff --git a/src/libGameNet/CMakeLists.txt b/src/libGameNet/CMakeLists.txt deleted file mode 100644 index 25d1e1f..0000000 --- a/src/libGameNet/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Settings -set(targetName libGameNet) - -# Get files to build -set(headers - ${CMAKE_CURRENT_LIST_DIR}/include/gameNet/client.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/gameNet/server.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/gameNet/nwEvents.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/gameNet/types.hpp - ${CMAKE_CURRENT_LIST_DIR}/sessionManager.hpp - ${CMAKE_CURRENT_LIST_DIR}/serverEvents.hpp -) - -set(sources - ${CMAKE_CURRENT_LIST_DIR}/client.cpp - ${CMAKE_CURRENT_LIST_DIR}/server.cpp - ${CMAKE_CURRENT_LIST_DIR}/nwEvents.cpp - ${CMAKE_CURRENT_LIST_DIR}/sessionManager.cpp -) - - -add_library(${targetName} STATIC - ${headers} ${sources} -) -add_library(go::gameNet ALIAS ${targetName}) - -target_include_directories(${targetName} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include -) - -target_link_libraries(${targetName} - PUBLIC - go::data - PRIVATE - go::network - nlohmann_json::nlohmann_json -) - -# Setup project settings -set_project_warnings(${targetName}) -set_compile_options(${targetName}) -set_output_directory(${targetName}) diff --git a/src/libNetwork/CMakeLists.txt b/src/libNetwork/CMakeLists.txt deleted file mode 100644 index c6a6502..0000000 --- a/src/libNetwork/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Settings -set(targetName libNetwork) - -# Get files to build -set(headers - ${CMAKE_CURRENT_LIST_DIR}/include/network/protocol.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/network/tcpServer.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/network/tcpClient.hpp - ${CMAKE_CURRENT_LIST_DIR}/connection.hpp -) - -set(sources - ${CMAKE_CURRENT_LIST_DIR}/tcpServer.cpp - ${CMAKE_CURRENT_LIST_DIR}/tcpClient.cpp - ${CMAKE_CURRENT_LIST_DIR}/connection.cpp -) - - -add_library(${targetName} STATIC - ${headers} ${sources} -) -add_library(go::network ALIAS ${targetName}) - -target_include_directories(${targetName} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include -) - -target_link_libraries(${targetName} - PRIVATE - asio -) - -# Setup project settings -set_project_warnings(${targetName}) -set_compile_options(${targetName}) -set_output_directory(${targetName}) diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index de7316b..b94f613 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -3,8 +3,8 @@ set(targetName "core.gtest") # Create executable add_executable(${targetName} - ${CMAKE_CURRENT_LIST_DIR}/game.gtest.cpp - ${CMAKE_CURRENT_LIST_DIR}/moveChecker.gtest.cpp + "${CMAKE_CURRENT_LIST_DIR}/game.gtest.cpp" + "${CMAKE_CURRENT_LIST_DIR}/moveChecker.gtest.cpp" ) # Link to required libraries diff --git a/tests/gameNet/CMakeLists.txt b/tests/gameNet/CMakeLists.txt index da89039..5ccdc3b 100644 --- a/tests/gameNet/CMakeLists.txt +++ b/tests/gameNet/CMakeLists.txt @@ -3,10 +3,10 @@ set(targetName "gameNet.gtest") # Create executable add_executable(${targetName} - ${CMAKE_CURRENT_LIST_DIR}/mockClient.cpp - ${CMAKE_CURRENT_LIST_DIR}/mockServer.cpp - ${CMAKE_CURRENT_LIST_DIR}/basic.gtest.cpp - ${CMAKE_CURRENT_LIST_DIR}/nwEvents.gtest.cpp + "${CMAKE_CURRENT_LIST_DIR}/mockClient.cpp" + "${CMAKE_CURRENT_LIST_DIR}/mockServer.cpp" + "${CMAKE_CURRENT_LIST_DIR}/basic.gtest.cpp" + "${CMAKE_CURRENT_LIST_DIR}/nwEvents.gtest.cpp" ) # Link to required libraries diff --git a/tests/network/CMakeLists.txt b/tests/network/CMakeLists.txt index 12f8426..6860aa6 100644 --- a/tests/network/CMakeLists.txt +++ b/tests/network/CMakeLists.txt @@ -3,7 +3,7 @@ set(targetName "network.gtest") # Create executable add_executable(${targetName} - ${CMAKE_CURRENT_LIST_DIR}/server.gtest.cpp + "${CMAKE_CURRENT_LIST_DIR}/server.gtest.cpp" ) # Link to required libraries From d7fb6adf5c8ab89a042cc31cbdafeaeab27340da Mon Sep 17 00:00:00 2001 From: Oliver Benz Date: Sat, 31 Jan 2026 17:56:39 +0100 Subject: [PATCH 10/10] CMake: Cosmetic changes and path protection. --- src/App/CMakeLists.txt | 5 +---- src/Camera/CMakeLists.txt | 6 +----- src/Core/CMakeLists.txt | 6 +----- src/Data/CMakeLists.txt | 1 - src/GameNet/CMakeLists.txt | 5 +---- src/Network/CMakeLists.txt | 5 +---- src/gui/CMakeLists.txt | 17 ++++++++--------- src/server/CMakeLists.txt | 3 +-- 8 files changed, 14 insertions(+), 34 deletions(-) diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index 8d35c2f..64f4071 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -1,4 +1,3 @@ -# Settings set(targetName App) # Get files to build @@ -19,9 +18,7 @@ set(sources "${CMAKE_CURRENT_LIST_DIR}/Logging.cpp" ) -add_library(${targetName} STATIC - ${headers} ${sources} -) +add_library(${targetName} STATIC ${headers} ${sources}) add_library(go::app ALIAS ${targetName}) target_include_directories(${targetName} diff --git a/src/Camera/CMakeLists.txt b/src/Camera/CMakeLists.txt index a1f0a37..5189639 100644 --- a/src/Camera/CMakeLists.txt +++ b/src/Camera/CMakeLists.txt @@ -1,4 +1,3 @@ -# Settings set(targetName Camera) find_package(OpenCV REQUIRED) @@ -9,10 +8,7 @@ set(sources "${CMAKE_CURRENT_LIST_DIR}/main.cpp") # TODO: This core/ will be a library. Not the executable. # Create target -add_executable(${targetName} - ${headers} - ${sources} -) +add_executable(${targetName} ${headers}${sources}) target_include_directories(${targetName} PRIVATE ${OpenCV_INCLUDE_DIRS}) target_link_libraries(${targetName} PRIVATE ${OpenCV_LIBS}) diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt index 3304a68..f6fbc08 100644 --- a/src/Core/CMakeLists.txt +++ b/src/Core/CMakeLists.txt @@ -1,4 +1,3 @@ -# Settings set(targetName Core) # Get files to build @@ -23,10 +22,7 @@ set(sources ) # Create target -add_library(${targetName} STATIC - ${headers} - ${sources} -) +add_library(${targetName} STATIC ${headers} ${sources}) add_library(go::core ALIAS ${targetName}) target_include_directories(${targetName} diff --git a/src/Data/CMakeLists.txt b/src/Data/CMakeLists.txt index 84df158..86580c6 100644 --- a/src/Data/CMakeLists.txt +++ b/src/Data/CMakeLists.txt @@ -1,4 +1,3 @@ -# Settings set(targetName Data) # Get files to build diff --git a/src/GameNet/CMakeLists.txt b/src/GameNet/CMakeLists.txt index 9a94935..04893a2 100644 --- a/src/GameNet/CMakeLists.txt +++ b/src/GameNet/CMakeLists.txt @@ -1,4 +1,3 @@ -# Settings set(targetName GameNet) # Get files to build @@ -19,9 +18,7 @@ set(sources ) -add_library(${targetName} STATIC - ${headers} ${sources} -) +add_library(${targetName} STATIC ${headers} ${sources}) add_library(go::gameNet ALIAS ${targetName}) target_include_directories(${targetName} diff --git a/src/Network/CMakeLists.txt b/src/Network/CMakeLists.txt index 5961b8f..e3a417c 100644 --- a/src/Network/CMakeLists.txt +++ b/src/Network/CMakeLists.txt @@ -1,4 +1,3 @@ -# Settings set(targetName Network) # Get files to build @@ -16,9 +15,7 @@ set(sources ) -add_library(${targetName} STATIC - ${headers} ${sources} -) +add_library(${targetName} STATIC ${headers} ${sources}) add_library(go::network ALIAS ${targetName}) target_include_directories(${targetName} diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 20313ba..1bb5be8 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1,17 +1,16 @@ -# Settings set(targetName goUi) find_package(Qt6 REQUIRED COMPONENTS Widgets) add_executable(${targetName} - ${CMAKE_CURRENT_LIST_DIR}/main.cpp - ${CMAKE_CURRENT_LIST_DIR}/MainWindow.cpp - ${CMAKE_CURRENT_LIST_DIR}/GameWidget.cpp - ${CMAKE_CURRENT_LIST_DIR}/BoardWidget.cpp - ${CMAKE_CURRENT_LIST_DIR}/boardRenderer.cpp - ${CMAKE_CURRENT_LIST_DIR}/ConnectDialog.cpp - ${CMAKE_CURRENT_LIST_DIR}/HostDialog.cpp - ${CMAKE_CURRENT_LIST_DIR}/Logging.cpp + "${CMAKE_CURRENT_LIST_DIR}/main.cpp" + "${CMAKE_CURRENT_LIST_DIR}/MainWindow.cpp" + "${CMAKE_CURRENT_LIST_DIR}/GameWidget.cpp" + "${CMAKE_CURRENT_LIST_DIR}/BoardWidget.cpp" + "${CMAKE_CURRENT_LIST_DIR}/boardRenderer.cpp" + "${CMAKE_CURRENT_LIST_DIR}/ConnectDialog.cpp" + "${CMAKE_CURRENT_LIST_DIR}/HostDialog.cpp" + "${CMAKE_CURRENT_LIST_DIR}/Logging.cpp" ) target_link_libraries(${targetName} diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 41a23ec..b7545e3 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -1,8 +1,7 @@ -# Settings set(targetName goServer) add_executable(${targetName} - ${CMAKE_CURRENT_LIST_DIR}/main.cpp + "${CMAKE_CURRENT_LIST_DIR}/main.cpp" ) target_link_libraries(${targetName}