Skip to content

Commit 921f348

Browse files
update cmake:
-- add utils -- add logs -- refactored
1 parent b16c0f8 commit 921f348

29 files changed

+623
-5702
lines changed

CMakeLists.txt

+52-24
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,66 @@
11
cmake_minimum_required(VERSION 3.14)
2-
project( propsdk )
32

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} )
85

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)
1116

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)
1519

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()
2229

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()
2435

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)
2639

27-
message( STATUS "Enabled examples: ${EXAMPLES_ENABLED}" )
28-
message( STATUS "Enabled tests: ${TESTS_ENABLED}" )
40+
include(Utils)
41+
include(clang-tidy)
42+
include(depends)
2943

3044
add_subdirectory(src)
3145

32-
if ( EXAMPLES_ENABLED )
33-
add_subdirectory(examples)
46+
# example
47+
if(BUILD_PROPLIB_EXAMPLE)
48+
add_subdirectory(example)
3449
endif()
3550

36-
if ( TESTS_ENABLED )
37-
add_subdirectory(tests)
51+
# test
52+
if(BUILD_PROPLIB_TEST)
53+
add_subdirectory(test)
3854
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

Comments
 (0)