summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-09-15 01:47:23 +0200
committerSven Gothel <[email protected]>2020-09-15 01:47:23 +0200
commitf6a9761008c87967d2790e78e362e6366d8fa8af (patch)
treeebd446a1322e331c9917f4aed91831b0e69b765c /examples
parent24cc8c1bca73f484d21fe8a8b2ab8b0c39d71097 (diff)
CMake: Support full parallel build by adding target dependencies
C++ Libs -> none (2x) Java Jar -> none Java JNI Libs -> C++ Lib + Java Jar (2x) C++ Examples -> C++ Libs Java Examples -> Java Jar Test -> C++ Lib +++ scripts/[re]build.sh uses `getconf _NPROCESSORS_ONLN` for the make -j <number of parallel processes>.
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt28
-rw-r--r--examples/java/CMakeLists.txt16
2 files changed, 27 insertions, 17 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index d0d05fa5..e20ff993 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -16,50 +16,56 @@ if(NOT SKIP_TINYB)
PROPERTIES
CXX_STANDARD 11
COMPILE_FLAGS "-Wall -Wextra -Werror")
+ target_link_libraries (hellotinyb tinyb)
+ add_dependencies(hellotinyb tinyb)
add_executable (checkinit tinyb/checkinit.cpp)
set_target_properties(checkinit
PROPERTIES
CXX_STANDARD 11
COMPILE_FLAGS "-Wall -Wextra -Werror")
+ target_link_libraries (checkinit tinyb)
+ add_dependencies(checkinit tinyb)
add_executable (asynctinyb tinyb/asynctinyb.cpp)
set_target_properties(asynctinyb
PROPERTIES
CXX_STANDARD 11
COMPILE_FLAGS "-Wall -Wextra -Werror")
+ target_link_libraries (asynctinyb tinyb)
+ add_dependencies(asynctinyb tinyb)
add_executable (esstinyb tinyb/esstinyb.cpp)
set_target_properties(esstinyb
PROPERTIES
CXX_STANDARD 11
COMPILE_FLAGS "-Wall -Wextra -Werror")
+ target_link_libraries (esstinyb tinyb)
+ add_dependencies(esstinyb tinyb)
add_executable (notifications tinyb/notifications.cpp)
set_target_properties(notifications
PROPERTIES
CXX_STANDARD 11
COMPILE_FLAGS "-Wall -Wextra -Werror")
+ target_link_libraries (notifications tinyb)
+ add_dependencies(notifications tinyb)
add_executable (uuid tinyb/uuid.cpp)
set_target_properties(uuid
PROPERTIES
CXX_STANDARD 11
COMPILE_FLAGS "-Wall -Wextra -Werror")
+ target_link_libraries (uuid tinyb)
+ add_dependencies(uuid tinyb)
add_executable (list_mfg tinyb/list_mfg.cpp)
set_target_properties(list_mfg
PROPERTIES
CXX_STANDARD 11
COMPILE_FLAGS "-Wall -Wextra -Werror")
-
- target_link_libraries (hellotinyb tinyb)
- target_link_libraries (checkinit tinyb)
- target_link_libraries (asynctinyb tinyb)
- target_link_libraries (esstinyb tinyb)
- target_link_libraries (notifications tinyb)
- target_link_libraries (uuid tinyb)
target_link_libraries (list_mfg tinyb)
+ add_dependencies(list_mfg tinyb)
endif()
@@ -69,6 +75,8 @@ set_target_properties(dbt_scanner00
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
COMPILE_FLAGS "-Wall -Wextra -Werror")
+target_link_libraries (dbt_scanner00 direct_bt)
+add_dependencies(dbt_scanner00 direct_bt)
add_executable (dbt_scanner01 direct_bt_scanner01/dbt_scanner01.cpp)
set_target_properties(dbt_scanner01
@@ -76,6 +84,8 @@ set_target_properties(dbt_scanner01
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
COMPILE_FLAGS "-Wall -Wextra -Werror")
+target_link_libraries (dbt_scanner01 direct_bt)
+add_dependencies(dbt_scanner01 direct_bt)
add_executable (dbt_scanner10 direct_bt_scanner10/dbt_scanner10.cpp)
set_target_properties(dbt_scanner10
@@ -83,10 +93,8 @@ set_target_properties(dbt_scanner10
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
COMPILE_FLAGS "-Wall -Wextra -Werror")
-
-target_link_libraries (dbt_scanner00 direct_bt)
-target_link_libraries (dbt_scanner01 direct_bt)
target_link_libraries (dbt_scanner10 direct_bt)
+add_dependencies(dbt_scanner10 direct_bt)
install(TARGETS dbt_scanner00 dbt_scanner01 dbt_scanner10 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/examples/java/CMakeLists.txt b/examples/java/CMakeLists.txt
index 3956a103..25e719a8 100644
--- a/examples/java/CMakeLists.txt
+++ b/examples/java/CMakeLists.txt
@@ -2,50 +2,52 @@ find_package(Java REQUIRED)
include(UseJava)
add_jar(HelloTinyB SOURCES HelloTinyB.java INCLUDE_JARS "${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar" ENTRY_POINT HelloTinyB)
-
add_custom_command(TARGET HelloTinyB
POST_BUILD
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/HelloTinyB.dir/HelloTinyB.class" "${CMAKE_CURRENT_BINARY_DIR}"
)
+add_dependencies(HelloTinyB tinybjar)
add_jar(AsyncTinyB SOURCES AsyncTinyB.java INCLUDE_JARS "${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar" ENTRY_POINT AsyncTinyB)
-
add_custom_command(TARGET AsyncTinyB
POST_BUILD
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/AsyncTinyB.dir/AsyncTinyB.class" "${CMAKE_CURRENT_BINARY_DIR}"
)
+add_dependencies(AsyncTinyB tinybjar)
add_jar(Notification SOURCES Notification.java INCLUDE_JARS "${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar" ENTRY_POINT Notification)
-
add_custom_command(TARGET Notification
POST_BUILD
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/Notification.dir/Notification.class" "${CMAKE_CURRENT_BINARY_DIR}"
)
+add_dependencies(Notification tinybjar)
add_jar(ScannerTinyB00 SOURCES ScannerTinyB00.java INCLUDE_JARS "${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar" ENTRY_POINT Notification)
-
add_custom_command(TARGET ScannerTinyB00
POST_BUILD
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/ScannerTinyB00.dir/ScannerTinyB00.class" "${CMAKE_CURRENT_BINARY_DIR}"
)
+add_dependencies(ScannerTinyB00 tinybjar)
add_jar(ScannerTinyB01 SOURCES ScannerTinyB01.java INCLUDE_JARS "${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar" ENTRY_POINT Notification)
-
add_custom_command(TARGET ScannerTinyB01
POST_BUILD
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/ScannerTinyB01.dir/ScannerTinyB01.class" "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar
)
+add_dependencies(ScannerTinyB01 tinybjar)
add_jar(ScannerTinyB02 SOURCES ScannerTinyB02.java INCLUDE_JARS "${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar" ENTRY_POINT Notification)
-
add_custom_command(TARGET ScannerTinyB02
POST_BUILD
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/ScannerTinyB02.dir/ScannerTinyB02.class" "${CMAKE_CURRENT_BINARY_DIR}"
)
+add_dependencies(ScannerTinyB02 tinybjar)
add_jar(ScannerTinyB10 SOURCES ScannerTinyB10.java INCLUDE_JARS "${CMAKE_CURRENT_BINARY_DIR}/../../java/tinyb2.jar" ENTRY_POINT Notification)
-
add_custom_command(TARGET ScannerTinyB10
POST_BUILD
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/ScannerTinyB10.dir/ScannerTinyB10.class" "${CMAKE_CURRENT_BINARY_DIR}"
)
+add_dependencies(ScannerTinyB10 tinybjar)
+