This repository has been archived on 2020-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
libs/CMakeLists.txt
2020-06-28 00:18:49 +03:00

188 lines
5.6 KiB
CMake

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW) # simpler variable expansion and escape sequence evaluation rules
endif()
project(libs)
set(PIP_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pip/cmake")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${PIP_CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/qad/cmake")
set(LIBPROJECT 1)
include(SDKMacros)
include(DeployMacros)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(NOT DEFINED BUILD_NUMBER)
set(BUILD_NUMBER 9999)
endif()
if("x${BUILD_NUMBER}" STREQUAL "x")
set(BUILD_NUMBER 0)
endif()
set(_COMPANY SHS)
set(_DOMAIN org.SHS)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/pip)
if(MINGW)
find_package(MinGW REQUIRED)
else()
if(APPLE)
set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks;@executable_path/lib;@loader_path/../lib")
set(CMAKE_MACOSX_RPATH TRUE)
if(CMAKE_CROSSCOMPILING)
set(CMAKE_INSTALL_NAME_DIR "@rpath")
else()
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
endif()
else()
set(CMAKE_INSTALL_RPATH "\$ORIGIN;\$ORIGIN/lib")
endif()
endif()
if (DEFINED ANDROID_PLATFORM)
include_directories(${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include)
#set(TARGET_INSTALL_PATH "${ANDROID_SYSTEM_LIBRARY_PATH}/usr/")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${ANDROID_NDK}/sysroot/usr/include")
#message("${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include")
#message("${ANDROID_NDK}/sysroot/usr/include")
endif()
set(INSTALL_PREFIX "")
set(_plugins_default_ 1)
if(CMAKE_CROSSCOMPILING)
if (DEFINED ANDROID_PLATFORM)
set(_plugins_default_ 0)
set(INSTALL_PREFIX "${CMAKE_FIND_ROOT_PATH}/")
else()
set(INSTALL_PREFIX "${CMAKE_STAGING_PREFIX}")
endif()
endif()
option(CROSSTOOLS "Crosstools minimal build" 0)
option(LIB "System install" 1)
option(QGLVIEW "Build QGLview library and utils" 0)
option(QGLENGINE "Build QGLENGINE library and utils" 0)
option(UTILS "Build various utils" ${_plugins_default_})
option(DESIGNER_PLUGINS "Build qt designer plugins" ${_plugins_default_})
if (CROSSTOOLS)
set(LIB 1)
set(QGLVIEW 0)
set(QGLENGINE 0)
set(UTILS 0)
set(DESIGNER_PLUGINS 0)
endif()
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -Wall")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wall")
endif()
set(CMAKE_CXX_STANDARD 11)
set(PIP_LIBRARY pip)
set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt" "introspection" "concurrent" "cloud")
set(PIP_INCLUDES)
if(LIB)
if(WIN32)
if(MINGW)
set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
endif()
else()
if (DEFINED ANDROID_PLATFORM)
set(CMAKE_INSTALL_PREFIX ${ANDROID_SYSTEM_LIBRARY_PATH}/usr)
else()
if(CMAKE_CROSSCOMPILING)
set(CMAKE_INSTALL_PREFIX ${CMAKE_STAGING_PREFIX})
else()
set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX}/usr/local)
endif()
endif()
endif()
message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"")
else()
message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"")
endif()
foreach(F ${PIP_FOLDERS})
list(APPEND PIP_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/pip/lib/main/${F}")
endforeach(F)
#message(${PIP_INCLUDES})
if(CMAKE_CROSSCOMPILING OR (DEFINED ANDROID_PLATFORM))
set(PIP_CMG "pip_cmg")
set(PIP_RC "pip_rc")
set(PIP_DEPLOY_TOOL "deploy_tool")
else()
set(PIP_CMG "${CMAKE_CURRENT_BINARY_DIR}/pip/utils/code_model_generator/pip_cmg")
set(PIP_RC "${CMAKE_CURRENT_BINARY_DIR}/pip/utils/resources_compiler/pip_rc")
set(PIP_DEPLOY_TOOL "${CMAKE_CURRENT_BINARY_DIR}/pip/utils/deploy_tool/deploy_tool")
endif()
if(WIN32)
set(PIP_DLL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pip")
endif()
set(QAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qad)
if (CROSSTOOLS)
add_subdirectory(pip)
file(GLOB CMAKES "qad/cmake/*.cmake" "qad/cmake/*.in")
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
else()
include(QtWraps)
find_qt(Core QUIET)
set(QtVersions)
set(SomeQtFound 0)
foreach(_v ${_QT_VERSIONS_})
option(Qt${_v} "Build for Qt${_v}" 1)
if (Qt${_v})
#message("Qt${_v} -> ${LOCAL_FOUND${_v}}")
if (LOCAL_FOUND${_v})
list(APPEND QtVersions Qt${_v})
set(SomeQtFound 1)
endif()
endif()
endforeach()
if(UTILS)
message(STATUS "Building with utils")
else()
message(STATUS "Building only libraries")
endif()
add_subdirectory(pip)
set(_DIRS)
if (SomeQtFound)
message(STATUS "Building Qt-derived targets for ${QtVersions}")
add_subdirectory(qad)
set(_DIRS piqt piqt_utils qcd_utils)
if (Qt5)
if (QGLVIEW)
list(APPEND _DIRS qglview)
endif()
if (QGLENGINE)
list(APPEND _DIRS qglengine)
endif()
endif()
foreach(_D ${_DIRS})
list(APPEND QT_MULTILIB_LIST ${_D})
endforeach(_D)
include_directories(piqt)
else()
message(STATUS "None of Qt found, skip Qt-derived targets")
endif()
include_directories(cd_utils)
list(INSERT _DIRS 0 cd_utils)
foreach(_D ${_DIRS})
add_subdirectory(${_D})
endforeach(_D)
endif()
if(WIN32)
foreach(PIP_LT ${PIP_LIBS_TARGETS})
if (SomeQtFound)
qt_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pip/lib${PIP_LT}.dll" DESTINATION QtBin)
endif()
endforeach()
endif()