DeviceScanner/CMakeLists.txt
Karutoh 06803e4215
All checks were successful
Build & Release / Linux-AMD64-Build (push) Successful in 13s
Build & Release / Linux-AARCH64-Build (push) Successful in 31s
Build & Release / Windows-AMD64-Build (push) Successful in 33s
Fixed CMakeLists.
2025-03-29 00:34:38 -07:00

69 lines
2.4 KiB
CMake

cmake_minimum_required(VERSION 3.25.1)
project(DeviceScanner C CXX)
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(IS_OS_WINDOWS TRUE)
set(USER_HOME_DIRECTORY $ENV{USERPROFILE})
message("Building for the Windows operating system.")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
set(IS_OS_LINUX TRUE)
set(USER_HOME_DIRECTORY $ENV{HOME})
add_compile_options(-Wno-stringop-overflow)
message("Building for the Linux operating system.")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
set(IS_OS_MAC TRUE)
set(USER_HOME_DIRECTORY $ENV{HOME})
message("Building for the Mac operating system.")
endif ()
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
message("Building for AMD64 architecture.")
set(IS_ARCH_AMD64 TRUE)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ARM64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
message("Building for ARM64 architecture.")
set(IS_ARCH_ARM64 TRUE)
endif ()
set(CMAKE_CXX_STANDARD 20)
add_executable(DeviceScanner main.cpp)
if (IS_OS_WINDOWS)
add_compile_definitions(VK_USE_PLATFORM_WIN32_KHR)
elseif (IS_OS_LINUX)
add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR EHS_WS_WAYLAND)
endif()
find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
message(STATUS "ZLIB was found.")
else ()
message(STATUS "ZLIB was not found.")
endif ()
find_package(OpenSSL REQUIRED)
if (OpenSSL_FOUND)
message(STATUS "OpenSSL was found.")
else ()
message(STATUS "OpenSSL was not found.")
endif ()
if (IS_OS_WINDOWS)
target_include_directories(DeviceScanner PRIVATE "${USER_HOME_DIRECTORY}/ehs/include")
target_link_directories(DeviceScanner PRIVATE "${USER_HOME_DIRECTORY}/ehs/lib")
target_link_libraries(DeviceScanner PRIVATE avrt ws2_32 IPHLPAPI)
elseif (IS_OS_LINUX)
target_include_directories(DeviceScanner PRIVATE "${USER_HOME_DIRECTORY}/.local/include")
target_link_directories(DeviceScanner PRIVATE "${USER_HOME_DIRECTORY}/.local/lib")
if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland")
target_link_libraries(DeviceScanner PRIVATE wayland-client)
elseif (LINUX_WINDOW_SYSTEM STREQUAL "XCB")
target_link_libraries(DeviceScanner PRIVATE xcb xcb-cursor xcb-xfixes xcb-xinput)
endif ()
target_link_libraries(DeviceScanner PRIVATE z asound pipewire-0.3)
endif ()
target_link_libraries(DeviceScanner PRIVATE EHS_Stc OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)