Mercurial > foo_out_sdl
comparison foosdk/CMakeLists.txt @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 cmake_minimum_required(VERSION 3.10) | |
| 2 | |
| 3 project(foosdk) | |
| 4 | |
| 5 if(NOT WIN32) | |
| 6 message(FATAL_ERROR "This project requires WIN32 target.") | |
| 7 endif() | |
| 8 | |
| 9 option(FOO_PPUI "Include libPPUI (adds usage of ATL/WTL)" ON) | |
| 10 option(FOO_SDK_HELPERS "Include SDK helpers (requires FOO_PPUI)" ON) | |
| 11 option(FOO_STATIC_STDLIB "Use static standard libraries" OFF) | |
| 12 option(FOO_SYSTEM_WTL "Use system WTL library" OFF) | |
| 13 option(FOO_SAMPLE "Build foo_sample component" OFF) | |
| 14 | |
| 15 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") | |
| 16 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4302 /wd4838 /wd4996 /d2notypeopt") | |
| 17 | |
| 18 if(FOO_STATIC_STDLIB) | |
| 19 foreach(FLAGS CMAKE_CXX_FLAGS_DEBUG | |
| 20 CMAKE_CXX_FLAGS_RELEASE | |
| 21 CMAKE_CXX_FLAGS_MINSIZEREL | |
| 22 CMAKE_CXX_FLAGS_RELWITHDEBINFO) | |
| 23 string(REPLACE "/MD" "/MT" ${FLAGS} "${${FLAGS}}") | |
| 24 endforeach() | |
| 25 endif() | |
| 26 | |
| 27 set(CMAKE_CXX_STANDARD 17) | |
| 28 set(WINVER 0x0601) | |
| 29 | |
| 30 add_definitions( | |
| 31 -D_UNICODE -DUNICODE -DSTRICT -DWINVER=${WINVER} -D_WIN32_WINNT=${WINVER} | |
| 32 ) | |
| 33 | |
| 34 set(INCLUDE_WTL OFF) | |
| 35 | |
| 36 if(FOO_PPUI) | |
| 37 if(FOO_SYSTEM_WTL) | |
| 38 find_package(Wtl REQUIRED) | |
| 39 target_include_directories(${WTL_INCLUDE_DIRS}) | |
| 40 else() | |
| 41 set(WTL_INCLUDE_DIRS "wtl/Include") | |
| 42 set(INCLUDE_WTL ON) | |
| 43 endif() | |
| 44 endif() | |
| 45 | |
| 46 function(option_dependency_check OPT1 OPT2) | |
| 47 if(${OPT1}) | |
| 48 if(NOT ${OPT2}) | |
| 49 message(SEND_ERROR "Option ${OPT1} requires option ${OPT2}") | |
| 50 endif() | |
| 51 endif() | |
| 52 endfunction() | |
| 53 | |
| 54 option_dependency_check(FOO_SDK_HELPERS FOO_PPUI) | |
| 55 option_dependency_check(FOO_SAMPLE FOO_SDK_HELPERS) | |
| 56 | |
| 57 include(FileLists) | |
| 58 | |
| 59 if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") | |
| 60 set(SHARED_LIBRARY sdk/foobar2000/shared/shared-x64.lib) | |
| 61 else() | |
| 62 set(SHARED_LIBRARY sdk/foobar2000/shared/shared-Win32.lib) | |
| 63 endif() | |
| 64 | |
| 65 set( | |
| 66 LIB_SOURCES | |
| 67 ${PFC_SOURCES} ${PFC_HEADERS} | |
| 68 ${SDK_SOURCES} ${SDK_HEADERS} | |
| 69 ${COMPONENT_CLIENT_SOURCES} | |
| 70 ) | |
| 71 | |
| 72 if(INCLUDE_WTL) | |
| 73 set(LIB_SOURCES ${LIB_SOURCES} ${WTL_HEADERS}) | |
| 74 endif() | |
| 75 | |
| 76 if(FOO_SDK_HELPERS) | |
| 77 set(LIB_SOURCES ${LIB_SOURCES} ${SDK_HELPERS_SOURCES} ${SDK_HELPERS_HEADERS}) | |
| 78 endif() | |
| 79 | |
| 80 if(FOO_PPUI) | |
| 81 set(LIB_SOURCES ${LIB_SOURCES} ${PPUI_SOURCES} ${PPUI_HEADERS}) | |
| 82 endif() | |
| 83 | |
| 84 add_library(foosdk STATIC ${LIB_SOURCES}) | |
| 85 | |
| 86 target_include_directories(foosdk PUBLIC sdk) | |
| 87 target_include_directories(foosdk PUBLIC sdk/foobar2000) | |
| 88 target_include_directories(foosdk PUBLIC ${WTL_INCLUDE_DIRS}) | |
| 89 target_link_libraries(foosdk PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${SHARED_LIBRARY}") | |
| 90 | |
| 91 if(FOO_SAMPLE) | |
| 92 add_library(foo_sample MODULE ${SAMPLE_SOURCES} ${SAMPLE_HEADERS}) | |
| 93 target_link_libraries(foo_sample foosdk) | |
| 94 endif() | |
| 95 | |
| 96 install(TARGETS foosdk ARCHIVE DESTINATION lib) | |
| 97 install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${SHARED_LIBRARY}" DESTINATION lib) | |
| 98 | |
| 99 install(FILES ${SHARED_HEADERS} DESTINATION include/foobar2000/shared) | |
| 100 install(FILES ${PFC_HEADERS} DESTINATION include/pfc) | |
| 101 install(FILES ${SDK_HEADERS} DESTINATION include/foobar2000/SDK) | |
| 102 | |
| 103 if(INCLUDE_WTL) | |
| 104 install(FILES ${WTL_HEADERS} DESTINATION include) | |
| 105 endif() | |
| 106 | |
| 107 if(FOO_SDK_HELPERS) | |
| 108 install(FILES ${SDK_HELPERS_HEADERS} DESTINATION include/foobar2000/helpers) | |
| 109 endif() | |
| 110 | |
| 111 if(FOO_PPUI) | |
| 112 install(FILES ${PPUI_HEADERS} DESTINATION include/libPPUI) | |
| 113 endif() |
