aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-10 07:32:59 -0500
committerJack Lloyd <[email protected]>2017-12-10 12:17:01 -0500
commitc55cced61a86f9d212243a9cedfa2a554af8be4d (patch)
treebebd0e82107bfa6fb62d1c82c074e709d54f08ea /src
parentbb54aa2479af5389b350e70fdfb274e2945d9092 (diff)
Use for loops in cmake and bakefile builds
Diffstat (limited to 'src')
-rw-r--r--src/build-data/bakefile.in22
-rw-r--r--src/build-data/cmake.in27
2 files changed, 36 insertions, 13 deletions
diff --git a/src/build-data/bakefile.in b/src/build-data/bakefile.in
index 0cd9eb581..3e808faac 100644
--- a/src/build-data/bakefile.in
+++ b/src/build-data/bakefile.in
@@ -1,23 +1,35 @@
toolsets = vs2013;
shared-library botan {
defines = "BOTAN_DLL=__declspec(dllexport)";
-%{bakefile_source_list}
+%{for lib_srcs}
+ sources { %{i} }
+%{endfor}
}
program cli {
deps = botan;
-%{bakefile_cli_list}
+%{for cli_srcs}
+ sources { %{i} }
+%{endfor}
+%{for cli_headers}
+ headers { %{i} }
+%{endfor}
+
}
program tests {
deps = botan;
-%{bakefile_tests_list}
+%{for test_srcs}
+ sources { %{i} }
+%{endfor}
}
includedirs += build/include/;
includedirs += build/include/external;
-%{bakefile_libs}
+%{for libs_used}
+libs += "%{i}";
+%{endfor}
-archs = %{cpu};
+archs = %{arch};
vs2013.option.ClCompile.DisableSpecificWarnings = "4250;4251;4275";
vs2013.option.ClCompile.WarningLevel = Level4;
diff --git a/src/build-data/cmake.in b/src/build-data/cmake.in
index 4fa906008..33c6cb962 100644
--- a/src/build-data/cmake.in
+++ b/src/build-data/cmake.in
@@ -6,23 +6,34 @@ cmake_policy(SET CMP0042 NEW)
endif()
set(BOTAN_SOURCES
-%{cmake_lib_sources})
+%{for lib_srcs}
+ "${CMAKE_CURRENT_LIST_DIR}/%{i}"
+%{endfor}
+)
set(BOTAN_CLI
-%{cmake_cli_sources})
+%{for cli_srcs}
+ "${CMAKE_CURRENT_LIST_DIR}/%{i}"
+%{endfor}
+)
set(BOTAN_TESTS
-%{cmake_test_sources})
+%{for test_srcs}
+ "${CMAKE_CURRENT_LIST_DIR}/%{i}"
+%{endfor}
+)
-%{cmake_compile_properties}
+%{for isa_build_info}
+set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/%{src}" PROPERTIES COMPILE_FLAGS "%{isa_flags}")
+%{endfor}
option(ENABLED_OPTIONAL_WARINIGS "If enabled more strict warning policy will be used" OFF)
option(ENABLED_LTO "If enabled link time optimization will be used" OFF)
-set(COMPILER_FEATURES_RELEASE %{cc_lang_flags} %{cc_compile_flags} %{cxx_abi_flags})
+set(COMPILER_FEATURES_RELEASE %{cc_lang_flags} %{cc_compile_opt_flags} %{cxx_abi_opt_flags})
set(COMPILER_FEATURES_DEBUG %{cc_lang_flags} %{cc_compile_debug_flags} %{cxx_abi_debug_flags})
set(COMPILER_FEATURES $<$<NOT:$<CONFIG:DEBUG>>:${COMPILER_FEATURES_RELEASE}> $<$<CONFIG:DEBUG>:${COMPILER_FEATURES_DEBUG}>)
-set(SHARED_FEATURES %{cmake_shared_flags})
+set(SHARED_FEATURES %{shared_flags})
set(STATIC_FEATURES -DBOTAN_DLL=)
set(COMPILER_WARNINGS %{cc_warning_flags})
set(COMPILER_INCLUDE_DIRS build/include build/include/external)
@@ -34,14 +45,14 @@ if(ENABLED_OPTIONAL_WARINIGS)
endif()
add_library(${PROJECT_NAME} STATIC ${BOTAN_SOURCES})
-target_link_libraries(${PROJECT_NAME} PUBLIC %{cmake_libs_used})
+target_link_libraries(${PROJECT_NAME} PUBLIC %{cmake_link_to})
target_compile_options(${PROJECT_NAME} PUBLIC ${COMPILER_WARNINGS} ${COMPILER_FEATURES} ${COMPILER_OPTIONAL_WARNINGS} PRIVATE ${STATIC_FEATURES})
target_include_directories(${PROJECT_NAME} PUBLIC ${COMPILER_INCLUDE_DIRS})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-static)
add_library(${PROJECT_NAME}_shared SHARED ${BOTAN_SOURCES})
-target_link_libraries(${PROJECT_NAME}_shared PUBLIC %{cmake_libs_used})
+target_link_libraries(${PROJECT_NAME}_shared PUBLIC %{cmake_link_to})
target_compile_options(${PROJECT_NAME}_shared PUBLIC ${COMPILER_WARNINGS} ${COMPILER_FEATURES} ${COMPILER_OPTIONAL_WARNINGS} PRIVATE ${SHARED_FEATURES})
target_include_directories(${PROJECT_NAME}_shared PUBLIC ${COMPILER_INCLUDE_DIRS})
set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME})