Skip to content

Commit

Permalink
fix: add subfolders to build scripts, make test config build only tes…
Browse files Browse the repository at this point in the history
…t target
  • Loading branch information
ThirdEyeSqueegee committed Oct 25, 2023
1 parent 159ad42 commit 81089c6
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 53 deletions.
28 changes: 13 additions & 15 deletions CommonLibSF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ source_group(
FILES ${SOURCES}
)

add_library(
${PROJECT_NAME}
STATIC
${SOURCES}
.clang-format
)

add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

function (configure_target TARGET_NAME)
target_compile_definitions(
${TARGET_NAME}
Expand Down Expand Up @@ -144,24 +135,22 @@ function (configure_target TARGET_NAME)
else()
CPMAddPackage("gh:herumi/[email protected]")
endif()

target_link_libraries(
${TARGET_NAME}
PUBLIC
xbyak::xbyak
)
endif()

target_precompile_headers(
${TARGET_NAME}
PRIVATE
include/SFSE/Impl/PCH.h
)
endfunction()

configure_target(${PROJECT_NAME})

if (SFSE_BUILD_TESTS)
if(SFSE_BUILD_TESTS)
# add a custom library target that just builds test.cpp
add_library(
${PROJECT_NAME}-test
Expand All @@ -171,9 +160,18 @@ if (SFSE_BUILD_TESTS)
${CMAKE_CURRENT_SOURCE_DIR}/test/test.cpp
)
configure_target(${PROJECT_NAME}-test)
set(PROJECT_NAME ${PROJECT_NAME}-test)
else()
add_library(
${PROJECT_NAME}
STATIC
${SOURCES}
.clang-format
)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
configure_target(${PROJECT_NAME})
endif()


if(USING_VCPKG)
install(
TARGETS ${PROJECT_NAME}
Expand Down
1 change: 1 addition & 0 deletions CommonLibSF/include/SFSE/Impl/PCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,4 +760,5 @@ namespace REL

#include "RE/F/FormTypes.h"
#include "RE/M/msvc.h"

#undef cdecl // Workaround for Clang.
5 changes: 2 additions & 3 deletions scripts/build-debug-clang-cl-cpm.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-ninja-cpm
cmake --build "%~dp0/../build" --config Debug
cmake -B "%~dp0/../build/build-debug-clang-cl-ninja-cpm" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-ninja-cpm
cmake --build "%~dp0/../build/build-debug-clang-cl-ninja-cpm" --config Debug
5 changes: 2 additions & 3 deletions scripts/build-debug-clang-cl-vcpkg.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-ninja-vcpkg
cmake --build "%~dp0/../build" --config Debug
cmake -B "%~dp0/../build/build-debug-clang-cl-ninja-vcpkg" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-ninja-vcpkg
cmake --build "%~dp0/../build/build-debug-clang-cl-ninja-vcpkg" --config Debug
3 changes: 3 additions & 0 deletions scripts/build-debug-msvc-cpm-test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo off
cmake -B "%~dp0/../build/build-debug-msvc-ninja-cpm-test" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-ninja-cpm -DSFSE_BUILD_TESTS=true
cmake --build "%~dp0/../build/build-debug-msvc-ninja-cpm-test" --config Debug
5 changes: 2 additions & 3 deletions scripts/build-debug-msvc-cpm.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-ninja-cpm
cmake --build "%~dp0/../build" --config Debug
cmake -B "%~dp0/../build/build-debug-msvc-ninja-cpm" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-ninja-cpm
cmake --build "%~dp0/../build/build-debug-msvc-ninja-cpm" --config Debug
5 changes: 2 additions & 3 deletions scripts/build-debug-msvc-vcpkg.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-ninja-vcpkg
cmake --build "%~dp0/../build" --config Debug
cmake -B "%~dp0/../build/build-debug-msvc-ninja-vcpkg" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-ninja-vcpkg
cmake --build "%~dp0/../build/build-debug-msvc-ninja-vcpkg" --config Debug
5 changes: 2 additions & 3 deletions scripts/build-release-clang-cl-cpm-test.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-release-clang-cl-ninja-cpm -DSFSE_BUILD_TESTS=true
cmake --build "%~dp0/../build" --config Release
cmake -B "%~dp0/../build/build-release-clang-cl-ninja-cpm-test" -S "%~dp0/../CommonLibSF" --preset=build-release-clang-cl-ninja-cpm -DSFSE_BUILD_TESTS=true
cmake --build "%~dp0/../build/build-release-clang-cl-ninja-cpm-test" --config Release
5 changes: 2 additions & 3 deletions scripts/build-release-clang-cl-cpm.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-release-clang-cl-ninja-cpm
cmake --build "%~dp0/../build" --config Release
cmake -B "%~dp0/../build/build-release-clang-cl-ninja-cpm" -S "%~dp0/../CommonLibSF" --preset=build-release-clang-cl-ninja-cpm
cmake --build "%~dp0/../build/build-release-clang-cl-ninja-cpm" --config Release
5 changes: 2 additions & 3 deletions scripts/build-release-clang-cl-vcpkg.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-release-clang-cl-ninja-vcpkg
cmake --build "%~dp0/../build" --config Release
cmake -B "%~dp0/../build/build-release-clang-cl-ninja-vcpkg" -S "%~dp0/../CommonLibSF" --preset=build-release-clang-cl-ninja-vcpkg
cmake --build "%~dp0/../build/build-release-clang-cl-ninja-vcpkg" --config Release
5 changes: 2 additions & 3 deletions scripts/build-release-msvc-cpm-test.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-release-msvc-ninja-cpm -DSFSE_BUILD_TESTS=true
cmake --build "%~dp0/../build" --config Release
cmake -B "%~dp0/../build/build-release-msvc-ninja-cpm-test" -S "%~dp0/../CommonLibSF" --preset=build-release-msvc-ninja-cpm -DSFSE_BUILD_TESTS=true
cmake --build "%~dp0/../build/build-release-msvc-ninja-cpm-test" --config Release
5 changes: 2 additions & 3 deletions scripts/build-release-msvc-cpm.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-release-msvc-ninja-cpm
cmake --build "%~dp0/../build" --config Release
cmake -B "%~dp0/../build/build-release-msvc-ninja-cpm" -S "%~dp0/../CommonLibSF" --preset=build-release-msvc-ninja-cpm
cmake --build "%~dp0/../build/build-release-msvc-ninja-cpm" --config Release
5 changes: 2 additions & 3 deletions scripts/build-release-msvc-vcpkg.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-release-msvc-ninja-vcpkg
cmake --build "%~dp0/../build" --config Release
cmake -B "%~dp0/../build/build-release-msvc-ninja-vcpkg" -S "%~dp0/../CommonLibSF" --preset=build-release-msvc-ninja-vcpkg
cmake --build "%~dp0/../build/build-release-msvc-ninja-vcpkg" --config Release
3 changes: 1 addition & 2 deletions scripts/make-sln-clang-cl-cpm.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-msvc-cpm
cmake -B "%~dp0/../build/build-debug-clang-cl-msvc-cpm" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-msvc-cpm
3 changes: 1 addition & 2 deletions scripts/make-sln-clang-cl-vcpkg.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-msvc-vcpkg
cmake -B "%~dp0/../build/build-debug-clang-cl-msvc-vcpkg" -S "%~dp0/../CommonLibSF" --preset=build-debug-clang-cl-msvc-vcpkg
3 changes: 1 addition & 2 deletions scripts/make-sln-msvc-cpm.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-msvc-cpm
cmake -B "%~dp0/../build/build-debug-msvc-msvc-cpm" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-msvc-cpm
3 changes: 1 addition & 2 deletions scripts/make-sln-msvc-vcpkg.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
echo off
rd /s /q "%~dp0/../build"
cmake -B "%~dp0/../build" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-msvc-vcpkg
cmake -B "%~dp0/../build/build-debug-msvc-msvc-vcpkg" -S "%~dp0/../CommonLibSF" --preset=build-debug-msvc-msvc-vcpkg

0 comments on commit 81089c6

Please sign in to comment.