1
1
cmake_minimum_required (VERSION 3.14)
2
- project ( propsdk )
3
2
4
- option (EDITOR_ENABLED "Should the editor to be." YES )
5
- option (EXAMPLES_ENABLED "Should the examples to be." YES )
6
- option (TESTS_ENABLED "Should the tests to be." YES )
7
- option (QT_EDITOR_ENABLED "Should the qt editor or imgui?." NO )
3
+ set (PROPLIB_NAME propsdk)
4
+ project ( ${PROPLIB_NAME} )
8
5
9
- add_library ( propsdk-cppfeatures INTERFACE )
10
- target_compile_features ( propsdk-cppfeatures INTERFACE cxx_std_17 )
6
+ set (PROPLIB_SOURCE_DIR ${PROJECT_SOURCE_DIR} )
7
+ set (PROPLIB_BINARY_DIR ${PROJECT_BINARY_DIR} )
8
+ set (PROPLIB_OUTPUT_DIR
9
+ "${PROPLIB_BINARY_DIR} /${CMAKE_SYSTEM_NAME} -${CMAKE_SYSTEM_PROCESSOR} " )
10
+
11
+ option (BUILD_SHARED_LIBS "The shared library" OFF )
12
+ option (BUILD_PROPLIB_EXAMPLE "Enable examples" ON )
13
+ option (BUILD_PROPLIB_TEST "Enable tests" ON )
14
+ option (BUILD_PROPLIB_WITH_EDITOR "Enable gui editor(default: imgui)" ON )
15
+ option (BUILD_PROPLIB_WITH_QT_EDITOR "Should the qt editor or imgui (default: imgui)" OFF )
11
16
12
- include ( cmake/warnings.cmake )
13
- add_library ( propsdk-cppwarnings INTERFACE )
14
- set_project_warinigs( propsdk-cppwarnings )
17
+ option (BUILD_PROPLIB_CLANG_TIDY_AUTO "Enable auto clang-tidy" OFF )
18
+ option (BUILD_PROPLIB_CLANG_TIDY_FIX "Enable autofix clang-tidy" OFF )
15
19
16
- target_include_directories ( propsdk-cppfeatures INTERFACE include )
17
-
18
- include ( cmake/dependency.cmake )
19
-
20
-
21
- add_library ( propsdk INTERFACE )
20
+ if (MSVC )
21
+ if (BUILD_SHARED_LIBS )
22
+ set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE )
23
+ endif ()
24
+ if (UNIX )
25
+ message (STATUS "Use position independent code" )
26
+ set_property (GLOBAL PROPERTY POSITION_INDEPENDENT_CODE ON )
27
+ endif ()
28
+ endif ()
22
29
23
- set_dependency ( propsdk-cppfeatures INTERFACE )
30
+ if (NOT CMAKE_BUILD_TYPE )
31
+ set (CMAKE_BUILD_TYPE
32
+ "Release"
33
+ CACHE STRING "Build configuration 'Release' or 'Debug'." FORCE)
34
+ endif ()
24
35
25
- target_link_libraries ( propsdk INTERFACE propsdk-cppfeatures propsdk-cppwarnings)
36
+ # cmake modules
37
+ list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} /cmake)
38
+ list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} /cmake/modules)
26
39
27
- message ( STATUS "Enabled examples: ${EXAMPLES_ENABLED} " )
28
- message ( STATUS "Enabled tests: ${TESTS_ENABLED} " )
40
+ include (Utils)
41
+ include (clang-tidy)
42
+ include (depends )
29
43
30
44
add_subdirectory (src)
31
45
32
- if ( EXAMPLES_ENABLED )
33
- add_subdirectory (examples)
46
+ # example
47
+ if (BUILD_PROPLIB_EXAMPLE)
48
+ add_subdirectory (example)
34
49
endif ()
35
50
36
- if ( TESTS_ENABLED )
37
- add_subdirectory (tests)
51
+ # test
52
+ if (BUILD_PROPLIB_TEST)
53
+ add_subdirectory (test )
38
54
endif ()
55
+
56
+ log (TEXT
57
+ "Target name ${PROPLIB_NAME} "
58
+ "Target config --> ${CMAKE_BUILD_TYPE} "
59
+ "Build shared library --> ${BUILD_SHARED_LIBS} "
60
+ "Build feature_traker examples ${BUILD_PROPLIB_EXAMPLE} "
61
+ "Build feature_traker test ${BUILD_PROPLIB_TEST} "
62
+ "Build with editor: ${BUILD_PROPLIB_WITH_EDITOR} "
63
+ " - qt editor ${BUILD_PROPLIB_WITH_QT_EDITOR} "
64
+ "Auto clang-tidy ${BUILD_PROPLIB_CLANG_TIDY_AUTO} "
65
+ "Auto clang-format ${BUILD_PROPLIB_CLANG_TIDY_FIX} "
66
+ SUMMARIZE)
0 commit comments