166 lines
4.8 KiB
CMake
166 lines
4.8 KiB
CMake
cmake_minimum_required(VERSION 3.0)
|
|
if (POLICY CMP0020)
|
|
cmake_policy(SET CMP0020 NEW)
|
|
endif()
|
|
if (POLICY CMP0011)
|
|
cmake_policy(SET CMP0011 NEW)
|
|
endif()
|
|
#if (POLICY CMP0017)
|
|
#cmake_policy(SET CMP0017 OLD)
|
|
#endif()
|
|
if (POLICY CMP0053)
|
|
cmake_policy(SET CMP0053 NEW)
|
|
endif()
|
|
project(libs)
|
|
include(SDKMacros.cmake)
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
set(LIBPROJECT 1)
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/pip/")
|
|
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/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 "")
|
|
if(CMAKE_CROSSCOMPILING)
|
|
if (DEFINED ANDROID_PLATFORM)
|
|
set(INSTALL_PREFIX "${CMAKE_FIND_ROOT_PATH}/")
|
|
else()
|
|
set(INSTALL_PREFIX "${CMAKE_STAGING_PREFIX}")
|
|
endif()
|
|
endif()
|
|
option(LIB "System install" 1)
|
|
option(DEBUG "Build with -g3" 0)
|
|
option(QGLVIEW "Build QGLview library and utils" 1)
|
|
option(QGLENGINE "Build QGLENGINE library and utils" 0)
|
|
option(UTILS "Build various utils" 1)
|
|
option(DESIGNER_PLUGINS "Build qt designer plugins" 1)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wall")
|
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
|
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
|
|
if (DEBUG)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
|
|
endif ()
|
|
include(SDKMacros.cmake)
|
|
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/src_main/${F}")
|
|
endforeach(F)
|
|
#message(${PIP_INCLUDES})
|
|
if(CMAKE_CROSSCOMPILING OR (DEFINED ANDROID_PLATFORM))
|
|
set(PIP_CMG "pip_cmg")
|
|
set(PIP_RC "pip_rc")
|
|
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")
|
|
endif()
|
|
if(WIN32)
|
|
set(PIP_DLL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pip")
|
|
endif()
|
|
|
|
set(QAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qad)
|
|
|
|
include(qad/QtWraps.cmake)
|
|
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)
|
|
else()
|
|
message(STATUS "None of Qt found, skip Qt-derived targets")
|
|
endif()
|
|
list(INSERT _DIRS 0 cd_utils deploy_tool)
|
|
foreach(_D ${_DIRS})
|
|
include_directories(${_D})
|
|
add_subdirectory(${_D})
|
|
endforeach(_D)
|
|
|
|
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()
|
|
set(CMAKES "FindMinGW.cmake")
|
|
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
|
|
endif()
|