Skip to content

Commit d7be8c4

Browse files
committed
split the test dir into gl/hgl
1 parent b8760e8 commit d7be8c4

44 files changed

Lines changed: 66 additions & 78 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.12)
22

33
# Check if cpp-gl is a top level project
44
if (NOT DEFINED PROJECT_NAME)
5-
set(CPP_GL_IS_TOP_LEVEL_PROJECT ON)
5+
set(CPP_GL_IS_TOP_LEVEL_PROJECT ON)
66
else()
7-
set(CPP_GL_IS_TOP_LEVEL_PROJECT OFF)
7+
set(CPP_GL_IS_TOP_LEVEL_PROJECT OFF)
88
endif()
99

1010
project(cpp-gl
@@ -14,14 +14,15 @@ project(cpp-gl
1414
LANGUAGES CXX
1515
)
1616

17+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1718
option(BUILD_TESTS "Build project tests" OFF)
1819

1920
# Set the proper cxx standard
2021
if(NOT DEFINED CMAKE_CXX_STANDARD)
21-
set(CMAKE_CXX_STANDARD 20)
22+
set(CMAKE_CXX_STANDARD 20)
2223
elseif(CMAKE_CXX_STANDARD LESS 20)
23-
message(WARNING "The defined C++ standard (${CMAKE_CXX_STANDARD}) is too low - overriding!")
24-
set(CMAKE_CXX_STANDARD 20)
24+
message(WARNING "The defined C++ standard (${CMAKE_CXX_STANDARD}) is too low - overriding!")
25+
set(CMAKE_CXX_STANDARD 20)
2526
endif()
2627
message(STATUS "The C++ standard is set to ${CMAKE_CXX_STANDARD}")
2728

@@ -82,5 +83,5 @@ export(PACKAGE cpp-gl)
8283

8384
# Include test directory if cpp-gl is a top level project
8485
if (CPP_GL_IS_TOP_LEVEL_PROJECT AND BUILD_TESTS)
85-
add_subdirectory(tests)
86+
add_subdirectory(tests)
8687
endif()

tests/CMakeLists.txt

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
cmake_minimum_required(VERSION 3.12)
22
project(cpp-gl-test)
33

4-
# Structure
5-
set(SOURCE_DIRS "source" "app")
6-
set(INCLUDE_DIRS "include" "external")
7-
set(EXECUTABLE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
8-
set(DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data")
9-
10-
# Source files
11-
file(GLOB_RECURSE SOURCES "")
12-
foreach(SOURCE_DIR ${SOURCE_DIRS})
13-
file(GLOB_RECURSE CURRENT_SOURCES ${SOURCE_DIR}/*.cpp)
14-
list(APPEND SOURCES ${CURRENT_SOURCES})
15-
endforeach()
16-
174
# Set compile options
185
if(NOT DEFINED CMAKE_CXX_FLAGS)
196
set(
@@ -23,15 +10,54 @@ if(NOT DEFINED CMAKE_CXX_FLAGS)
2310
)
2411
endif()
2512

26-
# Executable
27-
add_executable(run ${SOURCES})
28-
set_target_properties(run PROPERTIES
13+
# Common structure
14+
set(SOURCE_DIRS "app")
15+
set(INCLUDE_DIRS "include" "external")
16+
set(EXECUTABLE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
17+
18+
# Target-specific structure
19+
set(GL_SOURCE_DIRS "source/gl" ${SOURCE_DIRS})
20+
set(GL_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/gl")
21+
22+
set(HGL_SOURCE_DIRS "source/hgl" ${SOURCE_DIRS})
23+
set(HGL_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/hgl")
24+
25+
# GL: Source files
26+
set(GL_SOURCES "")
27+
foreach(SOURCE_DIR ${GL_SOURCE_DIRS})
28+
file(GLOB_RECURSE CURRENT_SOURCES ${SOURCE_DIR}/*.cpp)
29+
list(APPEND GL_SOURCES ${CURRENT_SOURCES})
30+
endforeach()
31+
32+
# GL: Executable
33+
add_executable(gl ${GL_SOURCES})
34+
set_target_properties(gl PROPERTIES
35+
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_DIR}"
36+
CXX_STANDARD ${CMAKE_CXX_STANDARD}
37+
CXX_STANDARD_REQUIRED YES
38+
CXX_EXTENSIONS NO
39+
)
40+
target_include_directories(gl PRIVATE ${INCLUDE_DIRS})
41+
target_compile_options(gl PRIVATE ${CMAKE_CXX_FLAGS})
42+
target_compile_definitions(gl PRIVATE GL_TESTING TEST_DATA_PATH="${GL_DATA_DIR}")
43+
target_link_libraries(gl PRIVATE cpp-gl)
44+
45+
# HGL: Source files
46+
set(HGL_SOURCES "")
47+
foreach(SOURCE_DIR ${HGL_SOURCE_DIRS})
48+
file(GLOB_RECURSE CURRENT_SOURCES ${SOURCE_DIR}/*.cpp)
49+
list(APPEND HGL_SOURCES ${CURRENT_SOURCES})
50+
endforeach()
51+
52+
# GL: Executable
53+
add_executable(hgl ${HGL_SOURCES})
54+
set_target_properties(hgl PROPERTIES
2955
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_DIR}"
3056
CXX_STANDARD ${CMAKE_CXX_STANDARD}
3157
CXX_STANDARD_REQUIRED YES
3258
CXX_EXTENSIONS NO
3359
)
34-
target_include_directories(run PRIVATE ${INCLUDE_DIRS})
35-
target_compile_options(run PRIVATE ${CMAKE_CXX_FLAGS})
36-
target_compile_definitions(run PRIVATE GL_TESTING TEST_DATA_PATH="${DATA_DIR}")
37-
target_link_libraries(run PRIVATE cpp-gl)
60+
target_include_directories(hgl PRIVATE ${INCLUDE_DIRS})
61+
target_compile_options(hgl PRIVATE ${CMAKE_CXX_FLAGS})
62+
target_compile_definitions(hgl PRIVATE GL_TESTING TEST_DATA_PATH="${HGL_DATA_DIR}")
63+
target_link_libraries(hgl PRIVATE cpp-gl)
File renamed without changes.
File renamed without changes.

tests/data/bicoloring_directed_not_bipartite_graph.gsf renamed to tests/data/gl/bicoloring_directed_not_bipartite_graph.gsf

File renamed without changes.

tests/data/bicoloring_undirected_bipartite_graph.gsf renamed to tests/data/gl/bicoloring_undirected_bipartite_graph.gsf

File renamed without changes.

tests/data/bicoloring_undirected_not_bipartite_graph.gsf renamed to tests/data/gl/bicoloring_undirected_not_bipartite_graph.gsf

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)