From 7b5c2c0babec3dd73e86ce331c9f5eaf045c34da Mon Sep 17 00:00:00 2001 From: Alex Melman Date: Sun, 16 Jan 2022 10:30:43 +0200 Subject: [PATCH] Include windows condition --- example/android/CMakeLists.txt | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/example/android/CMakeLists.txt b/example/android/CMakeLists.txt index 06454852b..34d6051c5 100644 --- a/example/android/CMakeLists.txt +++ b/example/android/CMakeLists.txt @@ -7,9 +7,14 @@ cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR) option(TONLIB_ENABLE_JNI "Enable JNI-compatible TonLib API" ON) -string(APPEND CMAKE_CXX_FLAGS " -std=c++14 -Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Wconversion -Wno-sign-conversion -fno-omit-frame-pointer -ffunction-sections -fdata-sections") -string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--gc-sections -Wl,--exclude-libs,ALL") - +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + string(APPEND CMAKE_CXX_FLAGS " -std=c++14 -fno-omit-frame-pointer -ffunction-sections -fdata-sections") +else() + string(APPEND CMAKE_CXX_FLAGS " -std=c++14 -Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Wconversion -Wno-sign-conversion -fno-omit-frame-pointer -ffunction-sections -fdata-sections") +endif() +if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--gc-sections -Wl,--exclude-libs,ALL") +endif() # Creates and names a library, sets it as either STATIC # or SHARED, and provides the relative paths to its source code. # You can define multiple libraries, and CMake builds them for you. @@ -37,9 +42,15 @@ target_link_libraries(native-lib tonlib) set(TONLIB_API_JAVA_PACKAGE "drinkless/org/ton") target_compile_definitions(native-lib PRIVATE PACKAGE_NAME="${TONLIB_API_JAVA_PACKAGE}") -add_custom_command(TARGET native-lib POST_BUILD - COMMAND ${CMAKE_COMMAND} -E rename $ $.debug - COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $.debug -o $) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + add_custom_command(TARGET native-lib POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename $ $.debug + COMMAND ${CMAKE_STRIP} -S $.debug -o $) +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + add_custom_command(TARGET native-lib POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename $ $.debug + COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $.debug -o $) +endif() if (NOT CMAKE_CROSSCOMPILING) set(TONLIB_API_JAVA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/)