From 705943abba487a44588113893f034839fb94964b Mon Sep 17 00:00:00 2001 From: John McCardle Date: Fri, 23 Feb 2024 21:55:16 -0500 Subject: [PATCH] initial cmake config (builds, python standard library not available) --- CMakeLists.txt | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0319341 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,62 @@ +# Minimum version of CMake required +cmake_minimum_required(VERSION 3.14) + +# Project name +project(McRogueFace) + +# Specify the C++ standard +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Add include directories +include_directories(${CMAKE_SOURCE_DIR}/deps_linux) +include_directories(${CMAKE_SOURCE_DIR}/deps_linux/Python-3.11.1) +include_directories(${CMAKE_SOURCE_DIR}/platform/linux) + +# Collect all the source files +file(GLOB_RECURSE SOURCES "src/*.cpp") + +# Create a list of libraries to link against +set(LINK_LIBS + m + dl + util + pthread + python3.11 + sfml-graphics + sfml-window + sfml-system + sfml-audio + tcod) + +# On Windows, add any additional libs and include directories +if(WIN32) + # Add the necessary Windows-specific libraries and include directories + # include_directories(path_to_additional_includes) + # link_directories(path_to_additional_libs) + # list(APPEND LINK_LIBS additional_windows_libs) +endif() + +# Add the directory where the linker should look for the libraries +link_directories(${CMAKE_SOURCE_DIR}/deps_linux) + +# Define the executable target before linking libraries +add_executable(mcrogueface ${SOURCES}) + +# Now the linker will find the libraries in the specified directory +target_link_libraries(mcrogueface ${LINK_LIBS}) + +# Copy assets to build directory post-build +add_custom_command(TARGET mcrogueface POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_SOURCE_DIR}/assets $/assets) + +# Copy Python scripts to build directory post-build +add_custom_command(TARGET mcrogueface POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_SOURCE_DIR}/src/scripts $/scripts) + +# rpath for including shared libraries +set_target_properties(mcrogueface PROPERTIES + INSTALL_RPATH "./lib") +