Files
Re3DExampleProject/CMakeLists.txt
2024-06-24 13:05:12 -04:00

56 lines
2.2 KiB
CMake

cmake_minimum_required(VERSION 3.18)
project(
Re3DExampleProject
VERSION 1.0
LANGUAGES CXX C
)
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}")
# Enable Package Managers
include(cmake/CPM.cmake)
file(GLOB_RECURSE HEADERS "include/*.h")
file(GLOB_RECURSE SOURCES "src/*.cpp")
#Copy assets & cfg to build directory.
file(COPY "assets" DESTINATION "${PROJECT_BINARY_DIR}")
file(COPY "cfg" DESTINATION "${PROJECT_BINARY_DIR}")
include_directories("include" "include/Re3D" "include/Re3D/Re3D")
#if(UNIX AND NOT APPLE)
#build Re3D and copy the lib directory to the build dir.
# execute_process(
# COMMAND bash -c "git clone https://git.redacted.cc/Redacted/Re3D.git && cd Re3D && mkdir build && cd build && cmake .. && make -j$(nproc) && mv lib/ ../../"
# )
#Copy the headers to include/Re3D
# execute_process(
# COMMAND bash -c "cd Re3D/include && mkdir Re3D && mv engine types Re3D && mv Re3D ${CMAKE_SOURCE_DIR}/include/Re3D && cd ../build/_deps && mv archive-src/include/archive.h event-src/include/Event.h event-src/include/EventConnection.h ${CMAKE_SOURCE_DIR}/include/Re3D && mv collage-src/include/Collage glad-src/include/glad glad-src/include/KHR j3ml-src/include/J3ML jgl-src/include/JGL rehardwareid-src/include/reHardwareID retexture-src/include/ReTexture rewindow-src/include/rewindow uuid-src/include/uuid ${CMAKE_SOURCE_DIR}/include/Re3D"
# )
#Delete the Re3D directory in the build directory.
# execute_process(COMMAND bash -c "rm -rf Re3D/")
#endif()
CPMAddPackage(
NAME Re3D
URL https://git.redacted.cc/Redacted/Re3D/archive/Prerelease-3.zip
)
add_executable(Re3DExampleProject ${SOURCES} ${HEADERS} main.cpp)
set_target_properties(Re3DExampleProject PROPERTIES LINKER_LANGUAGE CXX)
#Link based on relative path.
#set_target_properties(Re3DExampleProject PROPERTIES BUILD_RPATH "\$ORIGIN/lib")\
target_link_libraries(Re3DExampleProject PUBLIC Re3D)
#target_link_libraries(Re3DExampleProject PUBLIC GL glad J3ML ReWindowLibrary Re3D archive jlog)