Tweaked project structure, fixed tests

This commit is contained in:
Zac 2022-07-18 13:05:54 -04:00
parent e86ee1d3ab
commit 6b8ea1b942
32 changed files with 40 additions and 40 deletions

View File

@ -3,16 +3,19 @@ project(SCUS-97198)
cmake_minimum_required(VERSION 3.12)
set(CMAKE_CXX_STANDARD 20)
set (P2_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/P2)
set (ELF_TARGET SCUS_971.98)
set(P2_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/P2)
set(P2_LIB_TARGET P2)
set(P2_ELF_TARGET SCUS_971.98)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_subdirectory(${P2_SOURCE_DIR})
add_subdirectory(src)
target_include_directories(P2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests)

View File

@ -1,20 +0,0 @@
set (FILES
clock.cpp
coin.cpp
difficulty.cpp
game.cpp
gs.cpp
joy.cpp
util.cpp
xform.cpp
# ...
)
add_library(P2 STATIC ${FILES})
target_include_directories(P2 PUBLIC ${P2_SOURCE_DIR})
add_executable(${ELF_TARGET} main.cpp)
target_link_libraries(${ELF_TARGET} PUBLIC P2)

1
src/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory(P2)

18
src/P2/CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
set(P2_SOURCE_FILES
clock.cpp
coin.cpp
difficulty.cpp
game.cpp
gs.cpp
joy.cpp
util.cpp
xform.cpp
# ...
)
add_library(${P2_LIB_TARGET} STATIC ${P2_SOURCE_FILES})
target_include_directories(P2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_executable(${P2_ELF_TARGET} main.cpp)
target_link_libraries(${P2_ELF_TARGET} PUBLIC P2)

View File

@ -1,7 +1,7 @@
set (TESTNAMES "")
set(TESTNAMES "")
include (${CMAKE_CURRENT_SOURCE_DIR}/AddUnitTest.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/AddUnitTest.cmake)
add_subdirectory(clock)
add_subdirectory(coin)
@ -17,5 +17,3 @@ add_subdirectory(xform)
get_property(tests GLOBAL PROPERTY TESTNAMES)
add_custom_target(check DEPENDS ${tests})
# now make check should work for unix systems

View File

@ -1,2 +1,2 @@
add_unit_test(PARALLEL TRUE NAME clock.set_clock_rate SOURCES set_clock_rate.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME clock.set_clock_rate SOURCES set_clock_rate.cpp LIBS ${P2_LIB_TARGET})

View File

@ -1,2 +1,2 @@
add_unit_test(PARALLEL TRUE NAME coin.collect_coins SOURCES collect_coins.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME coin.collect_coins SOURCES collect_coins.cpp LIBS ${P2_LIB_TARGET})

View File

@ -1,3 +1,3 @@
add_unit_test(PARALLEL TRUE NAME difficulty.change_suck SOURCES change_suck.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME difficulty.world_preload SOURCES world_preload.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME difficulty.change_suck SOURCES change_suck.cpp LIBS ${P2_LIB_TARGET})
add_unit_test(PARALLEL TRUE NAME difficulty.world_preload SOURCES world_preload.cpp LIBS ${P2_LIB_TARGET})

View File

@ -1,4 +1,4 @@
add_unit_test(PARALLEL TRUE NAME game.set_coin_count SOURCES set_coin_count.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME game.set_charm_count SOURCES set_charm_count.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME game.charm_available SOURCES charm_available.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME game.set_coin_count SOURCES set_coin_count.cpp LIBS ${P2_LIB_TARGET})
add_unit_test(PARALLEL TRUE NAME game.set_charm_count SOURCES set_charm_count.cpp LIBS ${P2_LIB_TARGET})
add_unit_test(PARALLEL TRUE NAME game.charm_available SOURCES charm_available.cpp LIBS ${P2_LIB_TARGET})

View File

@ -1,2 +1,2 @@
add_unit_test(PARALLEL TRUE NAME gs.calculate_gs_percent SOURCES calculate_gs_percent.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME gs.calculate_gs_percent SOURCES calculate_gs_percent.cpp LIBS ${P2_LIB_TARGET})

View File

@ -1,3 +1,3 @@
add_unit_test(PARALLEL TRUE NAME joy.chetkido SOURCES chetkido.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME joy.add_fcht SOURCES add_fcht.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME joy.chetkido SOURCES chetkido.cpp LIBS ${P2_LIB_TARGET})
add_unit_test(PARALLEL TRUE NAME joy.add_fcht SOURCES add_fcht.cpp LIBS ${P2_LIB_TARGET})

View File

@ -1,3 +1,3 @@
add_unit_test(PARALLEL TRUE NAME util.limit_lm SOURCES limit_lm.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME util.limit_abs SOURCES limit_abs.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME util.limit_lm SOURCES limit_lm.cpp LIBS ${P2_LIB_TARGET})
add_unit_test(PARALLEL TRUE NAME util.limit_abs SOURCES limit_abs.cpp LIBS ${P2_LIB_TARGET})

View File

@ -1,2 +1,2 @@
add_unit_test(PARALLEL TRUE NAME xform.set_exits SOURCES set_exits.cpp LIBS DECOMP)
add_unit_test(PARALLEL TRUE NAME xform.set_exits SOURCES set_exits.cpp LIBS ${P2_LIB_TARGET})