# # @author Tobias Weber # @date jan-2019 # @license GPLv3, see 'LICENSE' file # cmake_minimum_required(VERSION 3.0) project(magstructfact) set(CMAKE_VERBOSE_MAKEFILE TRUE) option(BUILD_LIB "build as dynamic library" FALSE) # system specific settings message("Building for ${CMAKE_SYSTEM_NAME} systems.") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") # pass linker --subsystem option add_compile_options(-Wl,--subsystem,windows) elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") add_compile_options(-mmacosx-version-min=10.10) endif() find_package(Boost REQUIRED) find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL) set(CMAKE_AUTOUIC TRUE) set(CMAKE_AUTOMOC TRUE) set(CMAKE_CXX_STANDARD 20) add_definitions(-std=c++20) add_definitions(${Boost_CXX_FLAGS}) include_directories( "${PROJECT_SOURCE_DIR}" "${Boost_INCLUDE_DIRS}/.." "../.." "ext" "ext/gemmi/include" "ext/gemmi/third_party" "../../ext/gemmi/include" "../../ext/gemmi/third_party" ) if(BUILD_LIB) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) add_definitions(-DBUILD_LIB) add_library(takin_magstructfact SHARED magstructfact.cpp magstructfact.h ../../tlibs2/libs/glplot.cpp ../../tlibs2/libs/glplot.h) else() add_executable(takin_magstructfact magstructfact.cpp magstructfact.h ../../tlibs2/libs/glplot.cpp ../../tlibs2/libs/glplot.h) endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") target_link_options(takin_magstructfact # create an __info_plist section in the binary PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,${PROJECT_SOURCE_DIR}/../../setup_mac/InfoMagStructFact.plist ) endif() target_link_libraries(takin_magstructfact ${Boost_LIBRARIES}) qt5_use_modules(takin_magstructfact Core Gui Widgets OpenGL)