Skip to content

Commit da32613

Browse files
committed
add examples meta PCH target, speed up compilation of examples with PCH including CommonAPI and Nabla's PCH header, update examples_tests submodule
1 parent 509b21d commit da32613

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

cmake/common.cmake

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ function(update_git_submodule _PATH)
2121
)
2222
endfunction()
2323

24-
2524
# TODO: REDO THIS WHOLE THING AS FUNCTIONS
2625
# https://github.com/buildaworldnet/IrrlichtBAW/issues/311 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
2726

2827
# Macro creating project for an executable
2928
# Project and target get its name from directory when this macro gets executed (truncating number in the beginning of the name and making all lower case)
3029
# Created because of common cmake code for examples and tools
31-
macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDES _EXTRA_LIBS)
30+
macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDES _EXTRA_LIBS _PCH_TARGET)
3231
get_filename_component(EXECUTABLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
3332
string(REGEX REPLACE "^[0-9]+\." "" EXECUTABLE_NAME ${EXECUTABLE_NAME})
3433
string(TOLOWER ${EXECUTABLE_NAME} EXECUTABLE_NAME)
@@ -65,10 +64,21 @@ macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDE
6564

6665
# EXTRA_SOURCES is var containing non-common names of sources (if any such sources, then EXTRA_SOURCES must be set before including this cmake code)
6766
add_dependencies(${EXECUTABLE_NAME} Nabla)
68-
target_precompile_headers(${EXECUTABLE_NAME} REUSE_FROM Nabla)
67+
68+
if(NOT "${_PCH_TARGET}" STREQUAL "")
69+
if(NOT "${_PCH_TARGET}" STREQUAL Nabla)
70+
add_dependencies("${EXECUTABLE_NAME}" "${_PCH_TARGET}")
71+
endif()
72+
73+
target_precompile_headers("${EXECUTABLE_NAME}" REUSE_FROM "${_PCH_TARGET}")
74+
else()
75+
set_target_properties("${EXECUTABLE_NAME}" PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
76+
endif()
77+
6978
get_target_property(NBL_EGL_INCLUDE_DIRECORIES egl INCLUDE_DIRECTORIES)
7079

7180
target_include_directories(${EXECUTABLE_NAME}
81+
PUBLIC "${NBL_ROOT_PATH}/examples_tests/common"
7282
PUBLIC ../../include
7383
PRIVATE ${_EXTRA_INCLUDES}
7484
PRIVATE ${NBL_EGL_INCLUDE_DIRECORIES}

examples_tests

Submodule examples_tests updated 55 files

tools/convert2BAW/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ if(NOT RES)
44
message(FATAL_ERROR "common.cmake not found. Should be in {repo_root}/cmake directory")
55
endif()
66

7-
nbl_create_executable_project("" "" "" "")
7+
nbl_create_executable_project("" "" "" "" "")

0 commit comments

Comments
 (0)