cmake_minimum_required(VERSION 3.18..3.27) project(ReWindow VERSION 1.0 LANGUAGES CXX ) if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) message(FATAL_ERROR "In-Source builds are not allowed") endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # Enable Package Managers include(cmake/CPM.cmake) CPMAddPackage( NAME Event URL https://git.redacted.cc/josh/Event/archive/Release-12.zip ) CPMAddPackage( NAME jlog URL https://git.redacted.cc/josh/jlog/archive/Prerelease-16.zip ) #TODO dlopen these at runtime so if one isn't supported the program still works. if (UNIX AND NOT APPLE) include_directories(${Vulkan_INCLUDE_DIR}) endif() if (WIN32) include_directories(${VULKAN_SDK}/Include) endif() include_directories(${J3ML_SOURCE_DIR}/include) include_directories(${jlog_SOURCE_DIR}/include) file(GLOB_RECURSE HEADERS "include/*.h" "include/*.hpp") file(GLOB_RECURSE HEADERS "include/logger/*.h" "include/logger/*.hpp") if(UNIX AND NOT APPLE) file(GLOB_RECURSE SOURCES "src/types/*.cpp" "src/platform/linux/*.cpp" "src/platform/shared/*.cpp" "src/ReWindow/*.cpp" ) find_package(PkgConfig REQUIRED) pkg_check_modules(DBUS REQUIRED dbus-1) include_directories("include" ${DBUS_INCLUDE_DIRS}) endif() if(WIN32) file(GLOB_RECURSE SOURCES "src/types/*.cpp" "src/platform/windows/*.cpp" "src/platform/shared/*.cpp" "src/ReWindow/*.cpp") include_directories("include") endif() if(UNIX) add_library(ReWindow SHARED ${SOURCES}) endif() if(WIN32) add_library(ReWindow STATIC ${SOURCES}) endif() target_include_directories(ReWindow PUBLIC ${Event_SOURCE_DIR}/include) # Why god??? set_target_properties(ReWindow PROPERTIES LINKER_LANGUAGE CXX) if(UNIX AND NOT APPLE) target_link_libraries(ReWindow PUBLIC X11 Event jlog ${DBUS_LIBRARIES}) target_link_libraries(ReWindow PUBLIC) add_executable(ReWindowDemo main.cpp) target_link_libraries(ReWindowDemo PUBLIC ReWindow) endif() if(WIN32) target_compile_options(ReWindow PUBLIC /utf-8) target_link_libraries(ReWindow PUBLIC Event jlog) add_executable(ReWindowDemo main.cpp) target_link_libraries(ReWindowDemo PUBLIC ReWindow) endif()