Skip to content

Commit b9064d7

Browse files
committed
Improved structure and CMakeLists.txt
1 parent 44945c9 commit b9064d7

File tree

11 files changed

+23
-45
lines changed

11 files changed

+23
-45
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
cmake_minimum_required(VERSION 3.11)
1+
cmake_minimum_required(VERSION 3.21)
2+
3+
include(cmake/options.cmake)
4+
5+
project(interval-tree)
26

37
add_library(interval-tree INTERFACE)
48

59
target_include_directories(interval-tree INTERFACE ./include)
610

11+
if(DRAW_EXAMPLES)
12+
add_subdirectory(cairo-wrap)
13+
add_subdirectory(drawings)
14+
endif()
715
add_subdirectory(tests)

cmake/options.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
option(DRAW_EXAMPLES "Draws some examples in a subdirectory. run make_drawable.sh before this" OFF )

drawings/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
3+
add_executable(interval-tree-drawings "main.cpp")
4+
5+
target_link_libraries(interval-tree-drawings PRIVATE interval-tree cairo cairo-wrap)
6+
7+
set_target_properties(interval-tree-drawings PROPERTIES OUTPUT_NAME "make_drawings")

tests/example_drawings.hpp renamed to drawings/example_drawings.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#pragma once
2-
#ifdef INTERVAL_TREE_DO_DRAWINGS
32

4-
#include "../draw.hpp"
3+
#include <interval-tree/draw.hpp>
54

65
#include <string>
76

8-
void drawDocExample()
7+
static void drawDocExample()
98
{
109
using namespace lib_interval_tree;
1110

@@ -25,7 +24,7 @@ void drawDocExample()
2524
drawTree("drawings/doc_example.png", tree, false, false);
2625
}
2726

28-
void drawFromTests1()
27+
static void drawFromTests1()
2928
{
3029
using namespace lib_interval_tree;
3130
using namespace std::string_literals;
@@ -68,10 +67,8 @@ void drawFromTests1()
6867
drawTree("drawings/from_tests_1_deoverlapped.png", tree, false, false);
6968
}
7069

71-
void drawAll()
70+
static void drawAll()
7271
{
7372
drawDocExample();
7473
drawFromTests1();
7574
}
76-
77-
#endif // INTERVAL_TREE_DO_DRAWINGS
File renamed without changes.

tests/CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Version Check
2-
cmake_minimum_required(VERSION 3.11)
2+
cmake_minimum_required(VERSION 3.21)
33

44
# Default CXX Standard
55
if (NOT "${CMAKE_CXX_STANDARD}")
@@ -13,24 +13,13 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
1313
endif()
1414
endif()
1515

16-
option(DRAW_EXAMPLES "Draws some examples in a subdirectory. run make_drawable.sh before this" OFF )
17-
18-
# Project
19-
project(tree-tests)
20-
2116
# Add Files
2217
file(GLOB sources "*.cpp")
2318

2419
# Add Executable
2520
add_executable(tree-tests ${sources})
2621

2722
target_link_libraries(tree-tests PRIVATE gtest gmock interval-tree)
28-
# Options
29-
if(DRAW_EXAMPLES)
30-
target_compile_definitions(tree-tests PRIVATE -DINTERVAL_TREE_DO_DRAWINGS=1)
31-
find_library(LCAIRO_WRAP NAMES cairo_wrap PATHS "../../cairo-wrap/build" STATIC)
32-
target_link_libraries(tree-tests PRIVATE ${LCAIRO_WRAP} cairo)
33-
endif()
3423

3524
# Compiler Options
3625
set(DEBUG_OPTIONS -fexceptions -g -Wall -pedantic-errors -pedantic)

tests/make_drawable.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)