cmake_minimum_required(VERSION 2.6) project(libs) set(LIBPROJECT 1) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/pip/") cmake_policy(SET CMP0017 OLD) if(MINGW) find_package(MinGW REQUIRED) endif() option(LIB "System install" 1) option(DEBUG "Build with -g3" 0) option(QGLVIEW "Build QGLview library and utils" 0) 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 () set(PIP_LIBRARY pip) set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io" "console" "math" "code" "geo") set(PIP_INCLUDES) if (LIB) if(WIN32) set(CMAKE_INSTALL_PREFIX ${MINGW_DIR}) else() if(APPLE) set(CMAKE_INSTALL_PREFIX /usr/local) else() set(CMAKE_INSTALL_PREFIX /usr) endif() endif() message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") else() message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") endif() foreach(F ${PIP_FOLDERS}) list(APPEND PIP_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/pip/src_main/${F}") endforeach(F) #message(${PIP_INCLUDES}) set(PIP_CMG "${CMAKE_CURRENT_BINARY_DIR}/pip/utils/code_model_generator/pip_cmg") if(WIN32) set(PIP_DLL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pip") endif() set(QAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qad) add_subdirectory(pip) add_subdirectory(qad) set(_DIRS piqt piqt_utils cd_utils qcd_utils) if (QGLVIEW) list(APPEND _DIRS qglview) endif() foreach(_D ${_DIRS}) include_directories(${_D}) add_subdirectory(${_D}) endforeach(_D) if(WIN32) get_filename_component(QTDIR ${QT_QMAKE_EXECUTABLE} PATH) foreach(PIP_LT ${PIP_LIBS_TARGETS}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pip/lib${PIP_LT}.dll" DESTINATION ${QTDIR}) endforeach() set(CMAKES "FindMinGW.cmake") install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) endif()