Skip to content

Commit a58e0a4

Browse files
committed
WIP-ADD: working on structure for dll + testing + prototyping exe
1 parent d11c604 commit a58e0a4

File tree

8 files changed

+183
-23
lines changed

8 files changed

+183
-23
lines changed

.vscode/settings.json

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,72 @@
11
{
22
"files.associations": {
3-
"iostream": "cpp"
3+
"iostream": "cpp",
4+
"string": "cpp",
5+
"algorithm": "cpp",
6+
"array": "cpp",
7+
"atomic": "cpp",
8+
"bit": "cpp",
9+
"cctype": "cpp",
10+
"charconv": "cpp",
11+
"chrono": "cpp",
12+
"clocale": "cpp",
13+
"cmath": "cpp",
14+
"compare": "cpp",
15+
"concepts": "cpp",
16+
"cstddef": "cpp",
17+
"cstdint": "cpp",
18+
"cstdio": "cpp",
19+
"cstdlib": "cpp",
20+
"cstring": "cpp",
21+
"ctime": "cpp",
22+
"cwchar": "cpp",
23+
"exception": "cpp",
24+
"filesystem": "cpp",
25+
"format": "cpp",
26+
"forward_list": "cpp",
27+
"functional": "cpp",
28+
"initializer_list": "cpp",
29+
"iomanip": "cpp",
30+
"ios": "cpp",
31+
"iosfwd": "cpp",
32+
"istream": "cpp",
33+
"iterator": "cpp",
34+
"limits": "cpp",
35+
"list": "cpp",
36+
"locale": "cpp",
37+
"map": "cpp",
38+
"memory": "cpp",
39+
"new": "cpp",
40+
"optional": "cpp",
41+
"ostream": "cpp",
42+
"ratio": "cpp",
43+
"sstream": "cpp",
44+
"stdexcept": "cpp",
45+
"streambuf": "cpp",
46+
"system_error": "cpp",
47+
"tuple": "cpp",
48+
"type_traits": "cpp",
49+
"typeindex": "cpp",
50+
"typeinfo": "cpp",
51+
"unordered_map": "cpp",
52+
"unordered_set": "cpp",
53+
"utility": "cpp",
54+
"vector": "cpp",
55+
"xfacet": "cpp",
56+
"xhash": "cpp",
57+
"xiosbase": "cpp",
58+
"xlocale": "cpp",
59+
"xlocbuf": "cpp",
60+
"xlocinfo": "cpp",
61+
"xlocmes": "cpp",
62+
"xlocmon": "cpp",
63+
"xlocnum": "cpp",
64+
"xloctime": "cpp",
65+
"xmemory": "cpp",
66+
"xstddef": "cpp",
67+
"xstring": "cpp",
68+
"xtr1common": "cpp",
69+
"xtree": "cpp",
70+
"xutility": "cpp"
471
}
572
}

CMakeLists.txt

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,78 @@ cmake_minimum_required(VERSION 3.16.)
22
project(DiffCheck VERSION 1.0.0 LANGUAGES CXX C)
33
set(CMAKE_CXX_STANDARD 17)
44

5-
include(CTest)
6-
enable_testing()
7-
8-
set(BUILD_SHARED_LIBS ON)
95

106
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
117

12-
file(GLOB_RECURSE SOURCES src/*.cc src/*.hh)
8+
# # change the default build type to Release
9+
# if(NOT CMAKE_BUILD_TYPE)
10+
# set(CMAKE_BUILD_TYPE Release)
11+
# endif()
1312

14-
add_executable(${PROJECT_NAME} ${SOURCES})
1513

16-
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
14+
#--------------------------------------------------------------------------
15+
# options
16+
#--------------------------------------------------------------------------
17+
18+
#--------------------------------------------------------------------------
19+
# library
20+
#--------------------------------------------------------------------------
21+
1722

18-
target_include_directories(${PROJECT_NAME}
23+
set(SHARED_LIB_NAME diffCheck)
24+
25+
file(GLOB_RECURSE SOURCES_LIB
26+
src/diffCheck.cc src/diffCheck.hh # diffCheck interface
27+
src/diffCheck/*.cc src/diffCheck/*.hh # diffCheck src
28+
src/diffcheckpch.cc src/diffcheckpch.hh # precompiled headers
29+
)
30+
31+
add_library(${SHARED_LIB_NAME} SHARED ${SOURCES_LIB})
32+
33+
if (WIN32)
34+
set_target_properties(${SHARED_LIB_NAME} PROPERTIES
35+
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
36+
)
37+
endif()
38+
set_target_properties(${SHARED_LIB_NAME} PROPERTIES
39+
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin # for dll
40+
# ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin # for lib
41+
)
42+
43+
target_include_directories(${SHARED_LIB_NAME}
1944
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
2045
)
2146

47+
target_precompile_headers(${SHARED_LIB_NAME} PUBLIC src/diffcheckpch.hh)
48+
49+
50+
#--------------------------------------------------------------------------
51+
# executable
52+
#--------------------------------------------------------------------------
53+
54+
set(APP_NAME_EXE diffCheckApp)
55+
56+
add_executable(${APP_NAME_EXE} src/diffCheckApp.cc)
57+
58+
set_target_properties(${APP_NAME_EXE} PROPERTIES
59+
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
60+
)
61+
62+
target_link_libraries(${APP_NAME_EXE} ${SHARED_LIB_NAME})
63+
64+
target_include_directories(${APP_NAME_EXE}
65+
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
66+
)
2267

2368
#--------------------------------------------------------------------------
2469
# Pre-compiled headers
2570
#--------------------------------------------------------------------------
26-
target_precompile_headers(${PROJECT_NAME} PRIVATE src/diffcheckpch.hh)
71+
72+
#--------------------------------------------------------------------------
73+
# Tests
74+
#--------------------------------------------------------------------------
75+
76+
include(CTest)
77+
enable_testing()
78+
79+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/global)

src/diffCheck.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
3+
#include "diffCheck.hh" // This is a dummy include to test the include path
4+
5+
#include <string>
6+
#include <iostream>
7+
8+
namespace diffCheck {
9+
10+
int func1() { diffCheck::testHeaderCheck1(); return 1;}
11+
int func2() { diffCheck::testHeaderCheck2(); return 2;}
12+
int func3() { diffCheck::testHeaderCheck3(); return 3;}
13+
14+
} // namespace diffCheck

src/diffCheck.hh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
#pragma once
22

3-
#include "diffCheck/template.hh" // This is a dummy include to test the include path
3+
#include "diffCheck/libHeaderTemplate.hh" // This is a dummy include to test the include path
4+
5+
namespace diffCheck {
6+
7+
/// @brief Function 1 of the library
8+
int func1();
9+
10+
/// @brief Function 2 of the library
11+
int func2();
12+
13+
/// @brief Function 3 of the library
14+
int func3();
15+
16+
} // namespace diffCheck

src/diffCheck/libHeaderTemplate.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "libHeaderTemplate.hh"
2+
3+
#include <iostream>
4+
5+
namespace diffCheck {
6+
void testHeaderCheck1() {
7+
std::cout << "testHeaderCheck1 check." << std::endl;
8+
}
9+
10+
void testHeaderCheck2() {
11+
std::cout << "testHeaderCheck2 check." << std::endl;
12+
}
13+
14+
void testHeaderCheck3() {
15+
std::cout << "testHeaderCheck3 check." << std::endl;
16+
}
17+
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ namespace diffCheck {
88
};
99

1010
/// @brief Testing function for header import
11-
void testTemplateCheck();
11+
void testHeaderCheck1();
12+
/// @brief Testing function for header import
13+
void testHeaderCheck2();
14+
/// @brief Testing function for header import
15+
void testHeaderCheck3();
1216
} // namespace diffCheck

src/diffCheck/template.cc

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

src/diffCheckApp.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
#include "diffcheckpch.hh"
21
#include "diffCheck.hh"
32

43
int main() {
5-
diffCheck::testTemplateCheck();
4+
diffCheck::func1();
5+
diffCheck::func2();
6+
diffCheck::func3();
67
return 0;
78
}

0 commit comments

Comments
 (0)