175 lines
4.3 KiB
CMake
175 lines
4.3 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(shstk)
|
|
set(CMAKE_MODULE_PATH
|
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/pip/cmake"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/qad/cmake"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cd_utils/cmake"
|
|
)
|
|
|
|
include(QtWraps)
|
|
include(SHSTKMacros)
|
|
|
|
shstk_begin_project("" "")
|
|
|
|
option(CROSSTOOLS "Crosstools minimal build" OFF)
|
|
option(QGLVIEW "Build QGLView library and utils" OFF)
|
|
option(QGLENGINE "Build QGLEngine library and utils" OFF)
|
|
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()
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
add_subdirectory(pip)
|
|
find_package(PIP REQUIRED)
|
|
|
|
find_qt(Core QUIET)
|
|
if (SOME_QT_FOUND)
|
|
|
|
add_subdirectory(qad)
|
|
find_package(QAD REQUIRED)
|
|
|
|
endif()
|
|
|
|
#message("cmg = \"${PIP_CMG}\"")
|
|
#if (PIP_FOUND)
|
|
# message("found pip = \"${PIP_FOUND}\"")
|
|
#endif()
|
|
#message("inc = \"${PIP_INCLUDES}\"")
|
|
|
|
qt_add_executable(aaa ${CMAKE_CURRENT_SOURCE_DIR}/pip/main.cpp)
|
|
qt_target_link_libraries(aaa QAD::PIQtUtils)
|
|
#deploy_target(aaa DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
return()
|
|
|
|
add_subdirectory(cmake)
|
|
|
|
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)
|
|
foreach(F ${PIP_MAIN_FOLDERS})
|
|
list(APPEND PIP_INCLUDES "${F}")
|
|
endforeach(F)
|
|
add_subdirectory(cd_utils)
|
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/cd_utils" "${CMAKE_CURRENT_BINARY_DIR}/cd_utils")
|
|
set(_DIRS)
|
|
if (SomeQtFound)
|
|
#message(STATUS "Building Qt-derived targets for ${QtVersions}")
|
|
add_subdirectory(qad)
|
|
include_directories(${qad_includes})
|
|
add_subdirectory(piqt)
|
|
include_directories(${piqt_includes})
|
|
set(_DIRS)
|
|
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})
|
|
add_subdirectory(${_D})
|
|
endforeach(_D)
|
|
|
|
macro(align_list _list _out)
|
|
set(_max_len 0)
|
|
foreach(_m ${_list})
|
|
string(LENGTH "${_m}" _clen)
|
|
if (_clen GREATER _max_len)
|
|
set(_max_len ${_clen})
|
|
endif()
|
|
endforeach()
|
|
set(${_out})
|
|
foreach(_m ${_list})
|
|
set(_am "${_m}")
|
|
while(TRUE)
|
|
string(LENGTH "${_am}" _clen)
|
|
if (_clen GREATER_EQUAL ${_max_len})
|
|
break()
|
|
endif()
|
|
string(APPEND _am " ")
|
|
endwhile()
|
|
list(APPEND ${_out} "${_am}")
|
|
endforeach()
|
|
endmacro()
|
|
|
|
macro(print_list _list _name)
|
|
if (NOT "x${_list}" STREQUAL "x")
|
|
message("")
|
|
message(" ${_name}:")
|
|
#align_list("${_list}" _alist)
|
|
foreach(_m ${_list})
|
|
message(" * ${_m}")
|
|
endforeach()
|
|
endif()
|
|
endmacro()
|
|
|
|
message("----------QAD-----------")
|
|
message(" Build for ${QtVersions}")
|
|
message(" QAD Version: ${QAD_VERSION}")
|
|
message(" QAD Linkage: ${QAD_LIB_TYPE_MSG}")
|
|
message(" PIQt Version: ${PIQt_VERSION}")
|
|
message(" PIQt Linkage: ${PIQt_LIB_TYPE_MSG}")
|
|
print_list("${_qt_libs}" "Libraries")
|
|
print_list("${_qt_apps}" "Applications")
|
|
print_list("${_qt_plugs}" "Plugins")
|
|
message("-----------------------")
|
|
message("")
|
|
|
|
else()
|
|
message(STATUS "None of Qt found, skip Qt-derived targets")
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(WIN32)
|
|
foreach(PIP_LT ${PIP_MODULES})
|
|
if (SomeQtFound)
|
|
qt_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pip/lib${PIP_LT}.dll" DESTINATION QtBin)
|
|
endif()
|
|
endforeach()
|
|
endif()
|