#------------------------------------------------------------------- # This file is part of the CMake build system for ARToolKit # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. #------------------------------------------------------------------- ###################################################################### # ARToolKit BUILD SYSTEM # Welcome to the CMake build system for ARToolKit. # Inspired from the Ogre build system (modules FindPkgMacros.cmake, # PrecompiledHeader.cmake and PreprocessorUtils.cmake are Ogre's ones) # and provide build configuration options. # This is the main file where we prepare the general build environment ###################################################################### cmake_minimum_required (VERSION 2.8) cmake_policy(SET CMP0003 NEW) cmake_policy(SET CMP0007 OLD) cmake_policy(SET CMP0017 OLD) project(ARToolKit) # Include necessary submodules set(CMAKE_MODULE_PATH "${ARToolKit_SOURCE_DIR}/CMake" "${ARToolKit_SOURCE_DIR}/CMake/Utils") # CMake includes: include(CMakeDependentOption) include(CheckCXXCompilerFlag) include(PreprocessorUtils) include(ARToolKitMacroLogFeature) include(ARToolKitConfigTargets) set(ARToolKit_TEMPLATES_DIR "${ARToolKit_SOURCE_DIR}/CMake/Templates") set(ARToolKit_WORK_DIR ${ARToolKit_BINARY_DIR}) ##################################################################### # Set up the basic build environment ##################################################################### set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) if (CMAKE_BUILD_TYPE STREQUAL "") # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up # differentiation between debug and release builds. if (ANDROID) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) else() set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() endif () if (IOS) add_definitions(-DIOS) endif() # determine ARToolKit version numbers include(ARToolKitGetVersion) artoolkit_get_version(${ARToolKit_SOURCE_DIR}/include/AR/config.h.in) message(STATUS "Configuring ARToolKit ${ARToolKit_VERSION}") if (WIN32) # Create debug libraries with no postfix set(CMAKE_DEBUG_POSTFIX "") endif () if (CMAKE_COMPILER_IS_GNUCXX) # Fix x64 issues on Linux if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE) add_definitions(-fPIC) endif() endif (CMAKE_COMPILER_IS_GNUCXX) #default options #option ("ARToolKit_STATIC" "Build artoolkit in static" ON) # Find dependencies include(ARToolKitDependencies) # Specify build paths # On iOS, we want CMake to handle them automatically to prevent install issues if (NOT IOS) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${ARToolKit_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ARToolKit_BINARY_DIR}/lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${ARToolKit_BINARY_DIR}/bin") endif() # We don't want to install in default system location, install is really for the SDK, so call it for that if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if (WIN32) set(CMAKE_INSTALL_PREFIX "${ARToolKit_SOURCE_DIR}/sdk" CACHE PATH "ARToolKit install prefix" FORCE) elseif(APPLE AND NOT IOS) set(CMAKE_INSTALL_PREFIX "${ARToolKit_SOURCE_DIR}/sdk/OSX" CACHE PATH "ARToolKit install prefix" FORCE) elseif(APPLE AND IOS) set(CMAKE_INSTALL_PREFIX "${ARToolKit_SOURCE_DIR}/sdk/IOS" CACHE PATH "ARToolKit install prefix" FORCE) elseif(UNIX OR RPI) set(CMAKE_INSTALL_PREFIX "${ARToolKit_SOURCE_DIR}/sdk/linux" CACHE PATH "ARToolKit install prefix" FORCE) endif() endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) ###################################################################### # Provide user options to customise the build process ###################################################################### # Customise what to install if (WIN32) cmake_dependent_option(ARToolKit_INSTALL_PDB "Install debug pdb files" FALSE "MSVC" FALSE) endif () ################################################################### # configure global build settings based on selected build options ################################################################### include(ARToolKitConfigureBuild) ################################################################## # Now setup targets ################################################################## # Setup ARToolKit core projects add_subdirectory(lib)