From a4c33d15687de3bc9222c4f8c7dfea274935c756 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 6 May 2017 10:37:47 +0200 Subject: cmake: APPEND_STRING must have a space in front --- cmake/opentrack-boilerplate.cmake | 6 +++--- cmake/opentrack-version.cmake | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'cmake') diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index f716ec00..9f6e605b 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -75,7 +75,7 @@ endfunction() function(otr_compat target) if(NOT MSVC) - set_property(SOURCE ${${target}-moc} APPEND_STRING PROPERTY COMPILE_FLAGS "-w -Wno-error") + set_property(SOURCE ${${target}-moc} APPEND_STRING PROPERTY COMPILE_FLAGS " -w -Wno-error") endif() if(WIN32) target_link_libraries(${target} dinput8 dxguid strmiids) @@ -95,8 +95,8 @@ function(otr_compat target) set(l-props "-Wl,--as-needed") endif() - set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "${c-props} ${arg_COMPILE}") - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "${l-props} ${arg_LINK}") + set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS " ${c-props} ${arg_COMPILE}") + set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${l-props} ${arg_LINK}") endfunction() include(CMakeParseArguments) diff --git a/cmake/opentrack-version.cmake b/cmake/opentrack-version.cmake index 9cd597d3..00a5df1d 100644 --- a/cmake/opentrack-version.cmake +++ b/cmake/opentrack-version.cmake @@ -40,6 +40,6 @@ endif() add_library(opentrack-version STATIC ${CMAKE_BINARY_DIR}/version.c) if(NOT MSVC) - set_property(TARGET opentrack-version APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-lto") + set_property(TARGET opentrack-version APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-lto") endif() otr_compat(opentrack-version) -- cgit v1.2.3 From 7d6c570096ae885a24eb525195004fabb2cd7fed Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 6 May 2017 10:47:25 +0200 Subject: cmake: unbreak linker language detect for GNU --- cmake/opentrack-boilerplate.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 9f6e605b..7a88e6ef 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -84,9 +84,11 @@ function(otr_compat target) set(c-props) set(l-props) + get_property(linker-lang TARGET ${target} PROPERTY LINKER_LANGUAGE) + if(CMAKE_COMPILER_IS_GNUCXX) set(c-props "-fvisibility=hidden") - if(NOT is-c-only) + if(NOT linker-lang STREQUAL "C") set(c-props "${c-props} -fuse-cxa-atexit") endif() endif() -- cgit v1.2.3 From 8faea32f863988c6d55355aaf64f890923a5da5d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 6 May 2017 10:47:40 +0200 Subject: cmake/msvc: add -DHAS_EXCEPTIONS=0 --- cmake/opentrack-platform.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'cmake') diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 5bb7581a..3e0319ac 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -43,6 +43,7 @@ endif() if(MSVC) add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0) + add_definitions(-DHAS_EXCEPTIONS=0) set(CMAKE_CXX_FLAGS "-std:c++14 ${CMAKE_CXX_FLAGS}") if(SDK_INSTALL_DEBUG_INFO) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Zi") -- cgit v1.2.3 From 4604742029523e50eacd176c34fee04619c9d809 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 6 May 2017 13:17:04 +0200 Subject: cmake/msvc: -Gm requires -Zi --- cmake/msvc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake index bab3f3df..c0aee783 100644 --- a/cmake/msvc.cmake +++ b/cmake/msvc.cmake @@ -43,7 +43,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "opentrack") set(cc "${cc} /GR- /arch:SSE2") endif() -set(silly "${warns_} /MT /Gm") +set(silly "${warns_} -MT -Gm -Zi") set(_CFLAGS "${silly}") set(_CXXFLAGS "${silly}") -- cgit v1.2.3 From 36b6a3b606a36147672c5bf3a3615aaec5486d95 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 6 May 2017 13:17:20 +0200 Subject: cmake: also copy Qt pdb files if they exist --- cmake/opentrack-qt.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index d6c8315b..21bc42e1 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -6,7 +6,11 @@ set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} if(WIN32) foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets) - install(FILES "${Qt5_DIR}/../../../bin/${i}.dll" DESTINATION .) + set(path "${Qt5_DIR}/../../../bin/${i}") + install(FILES "${path}.dll" DESTINATION .) + if(EXISTS "${path}.pdb") + install(FILES "${path}.pdb" DESTINATION "${opentrack-hier-debug}") + endif() endforeach() install(FILES "${Qt5_DIR}/../../../plugins/platforms/qwindows.dll" DESTINATION "./platforms") endif() -- cgit v1.2.3 From ae2ced1284d3364c3f061044de377cfc624ca02e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 7 May 2017 11:14:45 +0200 Subject: cmake: fix var expansion for older cmake versions --- cmake/opentrack-boilerplate.cmake | 2 +- cmake/opentrack-policy.cmake | 32 +++++--------------------------- 2 files changed, 6 insertions(+), 28 deletions(-) (limited to 'cmake') diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 7a88e6ef..35ef1d22 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -88,7 +88,7 @@ function(otr_compat target) if(CMAKE_COMPILER_IS_GNUCXX) set(c-props "-fvisibility=hidden") - if(NOT linker-lang STREQUAL "C") + if(NOT ".${linker-lang}" STREQUAL ".C") set(c-props "${c-props} -fuse-cxa-atexit") endif() endif() diff --git a/cmake/opentrack-policy.cmake b/cmake/opentrack-policy.cmake index 2d88e218..7ded20f7 100644 --- a/cmake/opentrack-policy.cmake +++ b/cmake/opentrack-policy.cmake @@ -1,27 +1,5 @@ -if(POLICY CMP0020) - cmake_policy(SET CMP0020 NEW) -endif() - -if(POLICY CMP0058) - cmake_policy(SET CMP0058 NEW) -endif() - -if(POLICY CMP0028) - cmake_policy(SET CMP0028 NEW) -endif() - -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif() - -if(POLICY CMP0063) - cmake_policy(SET CMP0063 NEW) -endif() - -if(POLICY CMP0053) - cmake_policy(SET CMP0053 OLD) -endif() - -if(POLICY CMP0011) - cmake_policy(SET CMP0011 NEW) -endif() +foreach(k CMP0020 CMP0058 CMP0028 CMP0042 CMP0063 CMP0053 CMP0011 CMP0054) + if(POLICY ${k}) + cmake_policy(SET ${k} NEW) + endif() +endforeach() -- cgit v1.2.3 From 29ddc08ff2b5e8161f8c342cdb8fdafc9aa4a639 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 12 May 2017 15:41:22 +0200 Subject: cmake: don't relink when no headers change This makes release builds hella fast. --- cmake/opentrack-boilerplate.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 35ef1d22..821de1ba 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -128,11 +128,12 @@ endfunction() function(otr_module n_) message(STATUS "module ${n_}") cmake_parse_arguments(arg - "STATIC;NO-COMPAT;BIN;EXECUTABLE;NO-QT;WIN32-CONSOLE;NO-INSTALL" + "STATIC;NO-COMPAT;BIN;EXECUTABLE;NO-QT;WIN32-CONSOLE;NO-INSTALL;RELINK" "LINK;COMPILE" "SOURCES" ${ARGN} ) + if(NOT "${arg_UNPARSED_ARGUMENTS}" STREQUAL "") message(FATAL_ERROR "otr_module bad formals: ${arg_UNPARSED_ARGUMENTS}") endif() @@ -166,6 +167,12 @@ function(otr_module n_) add_library(${n} ${link-mode} "${${n}-all}") endif() + if(NOT arg_RELINK) + set_property(TARGET ${n} PROPERTY LINK_DEPENDS_NO_SHARED TRUE) + else() + set_property(TARGET ${n} PROPERTY LINK_DEPENDS_NO_SHARED FALSE) + endif() + if(NOT arg_NO-QT) target_link_libraries(${n} ${MY_QT_LIBS}) endif() -- cgit v1.2.3