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