aboutsummaryrefslogtreecommitdiffstats
path: root/JaulibSetup.cmake
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-01-25 17:35:34 +0100
committerSven Gothel <[email protected]>2021-01-25 17:35:34 +0100
commit88dda4d6c0c5ad84b8f029ca49bf55c3d4eef9ec (patch)
tree6f91935dd677328b2d49db6f0e47f218ba60402d /JaulibSetup.cmake
parent208a8ab9a604f68ce17c32263dda1897421240e8 (diff)
JaulibSetup.cmake: Respect USE_STRIP pre-set (don't override); javac debug flags back to default 'source,lines' -> override with JAVAC_DEBUG_ARGS
Diffstat (limited to 'JaulibSetup.cmake')
-rw-r--r--JaulibSetup.cmake35
1 files changed, 21 insertions, 14 deletions
diff --git a/JaulibSetup.cmake b/JaulibSetup.cmake
index 4bc0232..5ba1b93 100644
--- a/JaulibSetup.cmake
+++ b/JaulibSetup.cmake
@@ -38,6 +38,8 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CC_FLAGS_WARNING}")
endif(CMAKE_COMPILER_IS_GNUCC)
+message(STATUS "${PROJECT_NAME} USE_STRIP = ${USE_STRIP} (pre-set)")
+
if(DEBUG)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -ggdb -DDEBUG -fno-omit-frame-pointer ${GCC_FLAGS_STACK} -no-pie")
@@ -57,28 +59,24 @@ if(DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_FLAGS_SANITIZE_THREAD}")
endif(CMAKE_COMPILER_IS_GNUCC)
endif(INSTRUMENTATION)
- unset(USE_STRIP CACHE)
- message(STATUS "${PROJECT_NAME} strip not used")
elseif(GPROF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -ggdb -pg -fno-rtti")
- unset(USE_STRIP CACHE)
- message(STATUS "${PROJECT_NAME} strip not used")
elseif(PERF_ANALYSIS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -ggdb -fno-rtti")
- unset(USE_STRIP CACHE)
- message(STATUS "${PROJECT_NAME} strip not used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fno-rtti")
find_program(STRIP strip)
if (STRIP STREQUAL "STRIP-NOTFOUND")
- unset(USE_STRIP CACHE)
- message(STATUS "${PROJECT_NAME} strip not found")
- else()
- set(USE_STRIP true CACHE BOOL "strip usage")
- message(STATUS "${PROJECT_NAME} strip used")
+ set(USE_STRIP OFF)
+ message(STATUS "${PROJECT_NAME} USE_STRIP:=false, strip not found")
+ elseif(NOT DEFINED USE_STRIP)
+ set(USE_STRIP ON)
+ message(STATUS "${PROJECT_NAME} USE_STRIP:=true, !DEBUG and not set")
endif()
endif(DEBUG)
+message(STATUS "${PROJECT_NAME} USE_STRIP = ${USE_STRIP} (now)")
+
# '-latomic' is required using gcc-8 on Raspberry ... to avoid: undefined reference to `__atomic_store_8'
if(DEBUG)
if(CMAKE_COMPILER_IS_GNUCC)
@@ -177,13 +175,22 @@ IF(BUILDJAVA)
set(CMAKE_JAVA_COMPILE_FLAGS -source 11 -target 11)
if(DEBUG)
- set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:source,lines)
+ if(DEFINED JAVAC_DEBUG_ARGS)
+ set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:${JAVAC_DEBUG_ARGS})
+ else()
+ set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:source,lines)
+ endif()
else()
# Adding source,lines (default javac debug setting) adds ~13% or 30k.
# jaulib_fat.jar: No-Debug: 237458 bytes, Def-Debug: 267221 bytes (source, lines)
- set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:none)
- # set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:source,lines)
+ if(DEFINED JAVAC_DEBUG_ARGS)
+ set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:${JAVAC_DEBUG_ARGS})
+ else()
+ set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:source,lines)
+ # set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -g:none)
+ endif()
endif(DEBUG)
+ message(STATUS "${PROJECT_NAME} JAVAC_FLAGS = ${CMAKE_JAVA_COMPILE_FLAGS}")
ENDIF(BUILDJAVA)
endmacro()