1
0
mirror of https://github.com/alkoleft/yaxunit-addin.git synced 2024-12-12 08:23:54 +02:00
yaxunit-addin/CMakeLists.txt

73 lines
1.9 KiB
CMake
Raw Normal View History

2020-09-10 22:26:24 +02:00
cmake_minimum_required(VERSION 3.10)
project(YaxUnitAddIn)
2020-07-18 18:42:32 +02:00
set(CMAKE_CXX_STANDARD 17)
set(TARGET YaxUnitAddIn)
2023-08-09 00:13:44 +02:00
set(CMAKE_SHARED_LIBRARY_PREFIX "")
2020-07-18 18:42:32 +02:00
option(CASE_INSENSITIVE "Case insensitive method names" OFF)
option(STATIC_CRT "Static CRT linkage" OFF)
option(OUT_PARAMS "Support output parameters" OFF)
2020-09-10 22:26:24 +02:00
list(APPEND SOURCES
2020-07-18 18:42:32 +02:00
src/addin.def
src/stdafx.h
src/dllmain.cpp
src/exports.cpp
src/Component.cpp
src/Component.h
2023-08-29 17:32:16 +02:00
src/CommonAddIn.cpp
src/CommonAddIn.h)
2020-07-18 18:42:32 +02:00
2020-09-10 22:26:24 +02:00
if (ANDROID)
list(APPEND SOURCES
src/jnienv.cpp
src/jnienv.h)
endif ()
add_library(${TARGET} SHARED
${SOURCES})
2020-07-18 18:42:32 +02:00
target_compile_definitions(${TARGET} PRIVATE
UNICODE
_UNICODE)
if (CASE_INSENSITIVE)
target_compile_definitions(${TARGET} PRIVATE CASE_INSENSITIVE)
endif ()
if (OUT_PARAMS)
target_compile_definitions(${TARGET} PRIVATE OUT_PARAMS)
endif ()
target_include_directories(${TARGET} PRIVATE
include)
2020-08-18 23:39:24 +02:00
if (WIN32 AND NOT MSVC)
message(FATAL_ERROR "Must be compiled with MSVC on Windows")
endif ()
if (WIN32)
2020-07-18 18:42:32 +02:00
if (STATIC_CRT)
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif ()
target_compile_definitions(${TARGET} PRIVATE
_WINDOWS
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
2020-07-18 21:53:45 +02:00
target_compile_options(${TARGET} PRIVATE /utf-8)
2020-07-18 18:42:32 +02:00
endif ()
if (UNIX)
if (TARGET_ARCH STREQUAL "x86")
set(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}")
endif ()
2020-09-10 22:26:24 +02:00
endif ()
if (ANDROID)
if (CMAKE_BUILD_TYPE STREQUAL Release)
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_STRIP} ${CMAKE_SHARED_LIBRARY_PREFIX}${TARGET}${CMAKE_SHARED_LIBRARY_SUFFIX})
endif ()
2020-07-18 18:42:32 +02:00
endif ()