Skip to content

Commit

Permalink
Created a global CMake config to cover both Porytiles 1.x and 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
grunt-lucas committed Oct 20, 2024
1 parent 18e3622 commit 65bce7d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.DS_Store

# Build artifacts and executables
build/**
cmake-build-debug/**
Porytiles-1.x/build/**
Porytiles-1.x/cmake-build-debug/**

# LLVM coverage files
default.profraw
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.10)

project(Porytiles CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_VERBOSE_MAKEFILE on)

add_subdirectory(Porytiles-1.x)
9 changes: 1 addition & 8 deletions Porytiles-1.x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
cmake_minimum_required(VERSION 3.5)

project(Porytiles CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# set(CMAKE_VERBOSE_MAKEFILE on)
project(Porytiles1x CXX)

add_subdirectory(lib)
add_subdirectory(test)
Expand Down
10 changes: 5 additions & 5 deletions Porytiles-1.x/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project(PorytilesCliTool CXX)
project(Porytiles1xCliTool CXX)

add_executable(PorytilesCliTool main.cpp)
set_target_properties(PorytilesCliTool PROPERTIES OUTPUT_NAME "porytiles")
target_link_libraries(PorytilesCliTool PRIVATE PorytilesLibrary)
target_include_directories(PorytilesCliTool PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/doctest-2.4.11)
add_executable(Porytiles1xCliTool main.cpp)
set_target_properties(Porytiles1xCliTool PROPERTIES OUTPUT_NAME "porytiles")
target_link_libraries(Porytiles1xCliTool PRIVATE Porytiles1xLib)
target_include_directories(Porytiles1xCliTool PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/doctest-2.4.11)
20 changes: 10 additions & 10 deletions Porytiles-1.x/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
project(PorytilesLibrary CXX)
project(Porytiles1xLib CXX)

find_package(PNG REQUIRED)

FILE(GLOB CppSources src/*.cpp)
add_library(PorytilesLibrary OBJECT ${CppSources})
add_library(Porytiles1xLib OBJECT ${CppSources})
set(CANONICAL_LIB_NAME "porytiles")
set_target_properties(PorytilesLibrary PROPERTIES OUTPUT_NAME "${CANONICAL_LIB_NAME}")
target_include_directories(PorytilesLibrary PUBLIC ${PROJECT_SOURCE_DIR}/../vendor/fmt-10.1.1/include)
target_include_directories(PorytilesLibrary PUBLIC ${PROJECT_SOURCE_DIR}/../vendor/png++-0.2.9)
target_include_directories(PorytilesLibrary PUBLIC ${PNG_INCLUDE_DIRS})
set_target_properties(Porytiles1xLib PROPERTIES OUTPUT_NAME "${CANONICAL_LIB_NAME}")
target_include_directories(Porytiles1xLib PUBLIC ${PROJECT_SOURCE_DIR}/../vendor/fmt-10.1.1/include)
target_include_directories(Porytiles1xLib PUBLIC ${PROJECT_SOURCE_DIR}/../vendor/png++-0.2.9)
target_include_directories(Porytiles1xLib PUBLIC ${PNG_INCLUDE_DIRS})
# Force dependents to include files like "porytiles/compiler.h", while internally we can simply use "compiler.h"
target_include_directories(PorytilesLibrary INTERFACE ${PROJECT_SOURCE_DIR}/include PRIVATE ${PROJECT_SOURCE_DIR}/include/${CANONICAL_LIB_NAME})
target_include_directories(PorytilesLibrary PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/doctest-2.4.11)
target_include_directories(PorytilesLibrary PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/fast-cpp-csv-parser)
target_link_libraries(PorytilesLibrary PRIVATE PNG::PNG)
target_include_directories(Porytiles1xLib INTERFACE ${PROJECT_SOURCE_DIR}/include PRIVATE ${PROJECT_SOURCE_DIR}/include/${CANONICAL_LIB_NAME})
target_include_directories(Porytiles1xLib PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/doctest-2.4.11)
target_include_directories(Porytiles1xLib PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/fast-cpp-csv-parser)
target_link_libraries(Porytiles1xLib PRIVATE PNG::PNG)
8 changes: 4 additions & 4 deletions Porytiles-1.x/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(PorytilesTestSuite CXX)
project(Porytiles1xTestSuite CXX)

add_executable(PorytilesTestSuite tests.cpp)
target_link_libraries(PorytilesTestSuite PRIVATE PorytilesLibrary)
target_include_directories(PorytilesTestSuite PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/doctest-2.4.11)
add_executable(Porytiles1xTestSuite tests.cpp)
target_link_libraries(Porytiles1xTestSuite PRIVATE Porytiles1xLib)
target_include_directories(Porytiles1xTestSuite PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/doctest-2.4.11)

0 comments on commit 65bce7d

Please sign in to comment.