Pong/CMakeLists.txt
2024-07-01 19:39:05 -07:00

88 lines
3.0 KiB
CMake

cmake_minimum_required(VERSION 3.18.4)
project(Pong 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(Pong
Levels/Game.h
Levels/Game.cpp
Main.cpp
)
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)
add_compile_definitions(VK_USE_PLATFORM_WIN32_KHR)
target_include_directories(Pong PUBLIC ${USER_HOME_DIRECTORY}/EHS/include)
target_include_directories(Pong PUBLIC ${USER_HOME_DIRECTORY}/EHE/include)
target_include_directories(Pong PUBLIC ${USER_HOME_DIRECTORY}/EHC/include)
target_include_directories(Pong PUBLIC ${USER_HOME_DIRECTORY}/LWE/include)
target_include_directories(Pong PUBLIC $ENV{VULKAN_SDK}/include)
message("VK Include Path: $ENV{VULKAN_SDK}/include")
target_link_directories(Pong PUBLIC "${USER_HOME_DIRECTORY}/EHS/lib")
target_link_directories(Pong PUBLIC "${USER_HOME_DIRECTORY}/EHE/lib")
target_link_directories(Pong PUBLIC "${USER_HOME_DIRECTORY}/EHC/lib")
target_link_directories(Pong PUBLIC "${USER_HOME_DIRECTORY}/LWE/lib")
target_link_directories(Pong PUBLIC $ENV{VULKAN_SDK}/lib)
target_link_libraries(Pong PUBLIC vulkan-1 ws2_32 avrt)
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/LWE")
elseif (IS_OS_LINUX)
add_compile_definitions(VK_USE_PLATFORM_XCB_KHR EHS_WS_XCB)
find_package(Vulkan REQUIRED)
if (Vulkan_FOUND)
message(STATUS "Vulkan was found.")
else ()
message(STATUS "Vulkan was not found.")
endif ()
target_include_directories(Pong PUBLIC ${USER_HOME_DIRECTORY}/.local/include)
target_link_directories(Pong PUBLIC "${USER_HOME_DIRECTORY}/.local/lib")
target_link_libraries(Pong PUBLIC Vulkan::Headers)
target_link_libraries(Pong xcb xcb-cursor xcb-xfixes xcb-xinput wayland-client z asound Vulkan::Headers Vulkan::Vulkan)
endif()
target_link_libraries(Pong PRIVATE LWE EHC EHE EHS OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)