Skip to content

Commit

Permalink
devel/rttr: Fix build on 14- / modern Clang
Browse files Browse the repository at this point in the history
- the bundled rapidjson doesn't build on 14- because of changes
  in the STL; use the version from ports instead which has the
  changes needed already.
- the chaiscript examples don't build with modern Clang on 14-,
  and the examples are explicitly C++14 -- but still don't work

Replace the bundled rapidjson and chaiscripts with the
regular ports versions. There has been some work in git
on both rttr and chaiscript, but neither has a newer
release that might be pulled in, so we'll stick to messy
patching of rttr instead.
  • Loading branch information
Adriaan de Groot authored and Adriaan de Groot committed Nov 27, 2021
1 parent 1ed648e commit 5a0ece2
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 43 deletions.
15 changes: 12 additions & 3 deletions devel/rttr/Makefile
@@ -1,7 +1,7 @@
PORTNAME= rttr
DISTVERSIONPREFIX= v
DISTVERSION= 0.9.6-16
PORTREVISION= 1
PORTREVISION= 2
DISTVERSIONSUFFIX= -gb3a131c
CATEGORIES= devel

Expand All @@ -13,13 +13,22 @@ COMMENT= Run Time Type Reflection

LICENSE= MIT

USES= cmake compiler:c++11-lang
BUILD_DEPENDS= ${LOCALBASE}/include/rapidjson/rapidjson.h:devel/rapidjson \
${LOCALBASE}/include/chaiscript/chaiscript.hpp:lang/chaiscript

USES= cmake compiler:c++17-lang
USE_GITHUB= yes
GH_ACCOUNT= rttrorg

CMAKE_OFF= BUILD_DOCUMENTATION \
BUILD_UNIT_TESTS
BUILD_UNIT_TESTS \
BUILD_EXAMPLES

PORTSCOUT= limit:^0\.

post-extract:
${RM} -r ${WRKSRC}/3rd_party/rapidjson-1.1.0/
${RM} -r ${WRKSRC}/3rd_party/chaiscript-devel/
${RM} -r ${WRKSRC}/3rd_party/chaiscript-6.1.0/

.include <bsd.port.mk>

This file was deleted.

23 changes: 23 additions & 0 deletions devel/rttr/files/patch-CMake_3rd__party__libs.cmake
@@ -0,0 +1,23 @@
--- CMake/3rd_party_libs.cmake.orig 2019-01-18 18:25:46 UTC
+++ CMake/3rd_party_libs.cmake
@@ -53,7 +53,8 @@ if (BUILD_BENCHMARKS OR BUILD_EXAMPLES)
find_package(Threads REQUIRED)
endif()

-set(RAPID_JSON_DIR ${RTTR_3RD_PARTY_DIR}/rapidjson-1.1.0)
+find_package(RapidJSON REQUIRED)
+set(RAPID_JSON_DIR ${RapidJSON_INCLUDE_DIR})
set(NONIUS_DIR ${RTTR_3RD_PARTY_DIR}/nonius-1.1.2)

# Prepare "Catch" library for other executables
@@ -63,7 +64,9 @@ add_library(Catch2::Catch ALIAS Catch)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})

# Find chai script
-set(CHAISCRIPT_INCLUDE_DIR ${RTTR_3RD_PARTY_DIR}/chaiscript-6.1.0)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(_chaiscript REQUIRED chaiscript)
+set(CHAISCRIPT_INCLUDE_DIR ${_chaiscript_INCLUDEDIR})
add_library(ChaiScript INTERFACE)
add_library(ChaiScript::ChaiScript ALIAS ChaiScript)
target_include_directories(ChaiScript INTERFACE ${CHAISCRIPT_INCLUDE_DIR})
17 changes: 17 additions & 0 deletions devel/rttr/files/patch-src_examples_scripting_CMakeLists.txt
@@ -0,0 +1,17 @@
--- src/examples/scripting/CMakeLists.txt.orig 2021-11-27 21:00:51 UTC
+++ src/examples/scripting/CMakeLists.txt
@@ -41,12 +41,12 @@ endif()

add_executable(scripting_example ${SRC_FILES} ${HPP_FILES})
target_link_libraries(scripting_example RTTR::Core ChaiScript::ChaiScript ${CMAKE_DL_LIBS} Threads::Threads)
-# chaiscript minimum C++ version is 14
+# chaiscript minimum C++ version is 17
set_target_properties(scripting_example
PROPERTIES DEBUG_POSTFIX ${RTTR_DEBUG_POSTFIX}
FOLDER "Examples"
INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}"
- CXX_STANDARD 14)
+ CXX_STANDARD 17)
if (MSVC)
target_compile_options(scripting_example PRIVATE /bigobj)
endif()

0 comments on commit 5a0ece2

Please sign in to comment.