| 1 | #################################################
|
|---|
| 2 | # ___________ ____ ______ __ __ _____ #
|
|---|
| 3 | # \____ \__ \ _/ ___\\____ \| | \/ ___/ #
|
|---|
| 4 | # | |_> > __ \\ \___| |_> > | /\___ \ #
|
|---|
| 5 | # | __(____ /\___ > __/|____//____ > #
|
|---|
| 6 | # |__| \/ \/|__| \/ #
|
|---|
| 7 | # #
|
|---|
| 8 | #################################################
|
|---|
| 9 |
|
|---|
| 10 | # TODO: write the output variables of this CMake file.
|
|---|
| 11 |
|
|---|
| 12 | # Check PACPUS_ROOT
|
|---|
| 13 | if(NOT PACPUS_ROOT)
|
|---|
| 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()
|
|---|
| 26 | else()
|
|---|
| 27 | string (REPLACE "\\" "/" PACPUS_ROOT ${PACPUS_ROOT})
|
|---|
| 28 | message(STATUS "Detected PACPUS_ROOT as argument with the path: '${PACPUS_ROOT}'")
|
|---|
| 29 | endif()
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | # Hint directories
|
|---|
| 34 | set(PACPUS_INCLUDE_HINT ${PACPUS_ROOT}/include)
|
|---|
| 35 | set(PACPUS_LIBRARY_HINT ${PACPUS_ROOT}/lib)
|
|---|
| 36 |
|
|---|
| 37 | # Locate the include files
|
|---|
| 38 | find_path(
|
|---|
| 39 | PACPUS_INCLUDE_DIR
|
|---|
| 40 | NAMES
|
|---|
| 41 | "Pacpus"
|
|---|
| 42 | HINTS
|
|---|
| 43 | ${PACPUS_INCLUDE_HINT}
|
|---|
| 44 | DOC
|
|---|
| 45 | "The Pacpus include directory"
|
|---|
| 46 | )
|
|---|
| 47 |
|
|---|
| 48 | # List of required modules
|
|---|
| 49 | set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib")
|
|---|
| 50 | if(WIN32)
|
|---|
| 51 | list(APPEND PACPUS_MODULES "ROAD_TIME")
|
|---|
| 52 | endif()
|
|---|
| 53 |
|
|---|
| 54 | set(MODULE_MISSING FALSE)
|
|---|
| 55 | set(PACPUS_LIBRARIES "")
|
|---|
| 56 |
|
|---|
| 57 | # Check the presence of each module
|
|---|
| 58 | foreach(module ${PACPUS_MODULES})
|
|---|
| 59 | find_library(
|
|---|
| 60 | PACPUS_${module}_LIB
|
|---|
| 61 | NAMES
|
|---|
| 62 | ${module}
|
|---|
| 63 | HINTS
|
|---|
| 64 | ${PACPUS_LIBRARY_HINT}
|
|---|
| 65 | )
|
|---|
| 66 | find_library(
|
|---|
| 67 | PACPUS_${module}_LIBD
|
|---|
| 68 | NAMES
|
|---|
| 69 | ${module}_d
|
|---|
| 70 | HINTS
|
|---|
| 71 | ${PACPUS_LIBRARY_HINT}
|
|---|
| 72 | )
|
|---|
| 73 |
|
|---|
| 74 | if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD)
|
|---|
| 75 | list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})
|
|---|
| 76 | list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD})
|
|---|
| 77 | else()
|
|---|
| 78 | set(MODULE_MISSING TRUE)
|
|---|
| 79 | endif()
|
|---|
| 80 | endforeach()
|
|---|
| 81 |
|
|---|
| 82 | if(NOT MODULE_MISSING AND PACPUS_INCLUDE_DIR)
|
|---|
| 83 | set(PACPUS_FOUND TRUE)
|
|---|
| 84 |
|
|---|
| 85 | # Configure Pacpus
|
|---|
| 86 | list(APPEND CMAKE_MODULE_PATH "${PACPUS_ROOT}/cmake")
|
|---|
| 87 | include(${PACPUS_ROOT}/cmake/PacpusUtilities.cmake)
|
|---|
| 88 | include(${PACPUS_ROOT}/cmake/PacpusConfiguration.cmake)
|
|---|
| 89 | include(${PACPUS_ROOT}/cmake/PacpusDependencies.cmake)
|
|---|
| 90 | include(${PACPUS_ROOT}/cmake/PacpusPlatforms.cmake)
|
|---|
| 91 |
|
|---|
| 92 | #set(CMAKE_INSTALL_PREFIX ${PACPUS_ROOT})
|
|---|
| 93 | set(PACPUS_INSTALL_DIR ${PACPUS_ROOT})
|
|---|
| 94 | set(PACPUS_LIB_DIR "${PACPUS_ROOT}/lib")
|
|---|
| 95 | MESSAGE(STATUS "PACPUS_ROOT found ${PACPUS_ROOT}")
|
|---|
| 96 |
|
|---|
| 97 | else()
|
|---|
| 98 | set(PACPUS_FOUND FALSE)
|
|---|
| 99 |
|
|---|
| 100 | if(PACPUS_FIND_REQUIRED)
|
|---|
| 101 | MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
|
|---|
| 102 | else()
|
|---|
| 103 | MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
|
|---|
| 104 | endif()
|
|---|
| 105 |
|
|---|
| 106 | endif()
|
|---|