93 lines
2.3 KiB
CMake

file(GLOB makerwysxp CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/makerwysxp/*.cpp)
add_library(makerwysxp SHARED
${makerwysxp}
)
target_include_directories(makerwysxp PRIVATE
${CMAKE_SOURCE_DIR}/makerwysxp/include
${CMAKE_SOURCE_DIR}/file
)
set_target_properties(makerwysxp PROPERTIES
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/makerwysxp/include
)
target_compile_definitions(makerwysxp PRIVATE
_USE_MATH_DEFINES
)
target_compile_options(makerwysxp PRIVATE
-Wall
-Wextra
-pedantic
)
if(DEBUG)
target_compile_options(makerwysxp PRIVATE
-g
)
target_link_options(makerwysxp PRIVATE
-g
)
else()
target_compile_options(makerwysxp PRIVATE
-O2
)
endif()
if(APPLE)
message("Building makerwysxp for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}/${BIT}")
set_target_properties(makerwysxp PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}"
BUILD_WITH_INSTALL_NAME_DIR TRUE
)
target_compile_options(makerwysxp PRIVATE
"SHELL:-arch i386"
"SHELL:-arch x86_64"
)
target_link_options(makerwysxp PRIVATE
"SHELL:-arch i386"
"SHELL:-arch x86_64"
)
target_link_libraries(makerwysxp PRIVATE
"-framework Security"
)
elseif(UNIX)
message("Building makerwysxp for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
set_target_properties(makerwysxp PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}"
)
target_compile_options(makerwysxp PRIVATE
-nodefaultlibs
)
if(BIT STREQUAL "32")
target_compile_options(makerwysxp PRIVATE
-m32
)
target_link_options(makerwysxp PRIVATE
-m32
)
endif()
elseif(WIN32)
message("Building makerwysxp for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
set_target_properties(makerwysxp PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}"
)
if(DEBUG)
target_compile_options(makerwysxp PRIVATE
-gcodeview
)
target_link_options(makerwysxp PRIVATE
-Wl,-pdb=
)
endif()
target_link_options(makerwysxp PRIVATE
-static-libgcc
-static-libstdc++
)
endif()