[89] | 1 | #################################################
|
---|
| 2 | # ___________ ____ ______ __ __ _____ #
|
---|
| 3 | # \____ \__ \ _/ ___\\____ \| | \/ ___/ #
|
---|
| 4 | # | |_> > __ \\ \___| |_> > | /\___ \ #
|
---|
| 5 | # | __(____ /\___ > __/|____//____ > #
|
---|
| 6 | # |__| \/ \/|__| \/ #
|
---|
| 7 | # #
|
---|
| 8 | #################################################
|
---|
| 9 |
|
---|
| 10 | # TODO: write the output variables of this CMake file.
|
---|
| 11 |
|
---|
[304] | 12 | # Check PACPUS_ROOT
|
---|
| 13 | if(NOT PACPUS_ROOT)
|
---|
[306] | 14 | if(NOT ENV{PACPUS_ROOT} STREQUAL "")
|
---|
| 15 | set(PACPUS_ROOT $ENV{PACPUS_ROOT})
|
---|
| 16 | string (REPLACE "\\" "/" PACPUS_ROOT ${PACPUS_ROOT})
|
---|
| 17 | message(STATUS "Detected PACPUS_ROOT in environment, set to '${PACPUS_ROOT}'")
|
---|
| 18 | else()
|
---|
| 19 | if(PACPUS_FIND_REQUIRED)
|
---|
| 20 | MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
|
---|
| 21 | else()
|
---|
| 22 | MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
|
---|
| 23 | return()
|
---|
| 24 | endif()
|
---|
| 25 | endif()
|
---|
[304] | 26 | else()
|
---|
[306] | 27 | string (REPLACE "\\" "/" PACPUS_ROOT ${PACPUS_ROOT})
|
---|
| 28 | message(STATUS "Detected PACPUS_ROOT as argument with the path: '${PACPUS_ROOT}'")
|
---|
[304] | 29 | endif()
|
---|
| 30 |
|
---|
| 31 |
|
---|
[129] | 32 | # Locate the include files
|
---|
[306] | 33 | set(PACPUS_INCLUDE_DIR
|
---|
| 34 | "${PACPUS_ROOT}/include"
|
---|
[129] | 35 | )
|
---|
[89] | 36 |
|
---|
[129] | 37 | if(NOT PACPUS_INCLUDE_DIR)
|
---|
[306] | 38 | message(FATAL_ERROR "Could not find PACPUS. Please set CMake variable PACPUS_ROOT or environment variable PACPUS_ROOT.")
|
---|
[129] | 39 | endif()
|
---|
[89] | 40 |
|
---|
[304] | 41 | #get_filename_component(PACPUS_ROOT ${PACPUS_INCLUDE_DIR}/.. ABSOLUTE)
|
---|
[129] | 42 | set(PACPUS_LIB_DIR ${PACPUS_ROOT}/lib)
|
---|
[89] | 43 |
|
---|
| 44 | # List of required modules
|
---|
| 45 | set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib")
|
---|
| 46 | if(WIN32)
|
---|
[306] | 47 | list(APPEND PACPUS_MODULES "ROAD_TIME")
|
---|
[89] | 48 | endif()
|
---|
| 49 |
|
---|
| 50 | set(MODULE_MISSING FALSE)
|
---|
| 51 | set(PACPUS_LIBRARIES "")
|
---|
| 52 |
|
---|
[304] | 53 | message (${PACPUS_LIB_DIR})
|
---|
| 54 |
|
---|
[89] | 55 | # Check the presence of each module
|
---|
| 56 | foreach(module ${PACPUS_MODULES})
|
---|
[306] | 57 |
|
---|
| 58 | # release version
|
---|
| 59 | find_library(
|
---|
| 60 | PACPUS_${module}_LIB
|
---|
| 61 | NAMES ${module}
|
---|
| 62 | HINTS ${PACPUS_LIB_DIR}
|
---|
| 63 | )
|
---|
| 64 | if(PACPUS_${module}_LIB)
|
---|
| 65 | list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})
|
---|
| 66 | else()
|
---|
| 67 | message(SEND_ERROR "Cannot find Pacpus module ${module} (release version)")
|
---|
| 68 | set(MODULE_MISSING TRUE)
|
---|
| 69 | endif()
|
---|
| 70 |
|
---|
| 71 | # debug version
|
---|
| 72 | find_library(
|
---|
| 73 | PACPUS_${module}_LIBD
|
---|
| 74 | NAMES ${module}_d
|
---|
| 75 | HINTS ${PACPUS_LIB_DIR}
|
---|
| 76 | )
|
---|
| 77 | if(PACPUS_${module}_LIBD)
|
---|
| 78 | list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD})
|
---|
| 79 | else()
|
---|
| 80 | message(SEND_ERROR "Cannot find Pacpus module ${module}_d (debug version)")
|
---|
| 81 | set(MODULE_MISSING TRUE)
|
---|
| 82 | endif()
|
---|
| 83 |
|
---|
[89] | 84 | endforeach()
|
---|
| 85 |
|
---|
[129] | 86 | # handle the QUIETLY and REQUIRED arguments and set PACPUS_FOUND to TRUE if
|
---|
| 87 | # all listed variables are TRUE
|
---|
| 88 | include (FindPackageHandleStandardArgs)
|
---|
| 89 | set(PACPUS_ALL_MODULES_FOUND NOT MODULE_MISSING)
|
---|
| 90 | find_package_handle_standard_args (PACPUS DEFAULT_MSG PACPUS_LIBRARIES PACPUS_INCLUDE_DIR PACPUS_ALL_MODULES_FOUND)
|
---|
[89] | 91 |
|
---|
[129] | 92 | if(PACPUS_FOUND)
|
---|
[306] | 93 | set(PACPUS_INSTALL_DIR ${PACPUS_ROOT})
|
---|
| 94 | set(PACPUS_CMAKE_DIR ${PACPUS_ROOT}/cmake)
|
---|
| 95 | set(CMAKE_INSTALL_PREFIX ${PACPUS_INSTALL_DIR})
|
---|
| 96 | list(APPEND CMAKE_PREFIX_PATH ${PACPUS_CMAKE_DIR})
|
---|
| 97 | list(APPEND CMAKE_MODULE_PATH "${PACPUS_CMAKE_DIR}")
|
---|
| 98 |
|
---|
| 99 | include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
|
---|
| 100 | include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
|
---|
| 101 | include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
|
---|
| 102 | include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
|
---|
| 103 | endif() |
---|