@@ -4,21 +4,21 @@ if(${CMAKE_VERSION} VERSION_GREATER "3.24.0")
44 cmake_policy (SET CMP0135 NEW )
55endif ()
66include (FetchContent )
7- FetchContent_Declare (inklecate_mac
8- URL https://github.com/inkle/ink/releases/download/v1.1.1/ inklecate_mac.zip
9- URL_HASH SHA256=c516402bca5fa249a7712e62591b048b137eba3098c53f9fb85a4253f9b9e2c0
10- SOURCE_DIR " ${CMAKE_BINARY_DIR} /inklecate/mac"
11- )
12- FetchContent_Declare (inklecate_windows
13- URL https://github.com/inkle/ink/releases/download/v1.1.1/ inklecate_windows.zip
14- URL_HASH SHA256=6f317cb4c59bf1b31c6dd61e80c6a2287a1d8c241a703f0586f736ae00871aab
15- SOURCE_DIR " ${CMAKE_BINARY_DIR} /inklecate/windows"
16- )
17- FetchContent_Declare (inklecate_linux
18- URL https://github.com/inkle/ink/releases/download/v1.1.1/ inklecate_linux.zip
19- URL_HASH SHA256=26f4e188e02536d6e99e73e71d9b13e2c2144187f1368a87e82fd5066176cff8
20- SOURCE_DIR " ${CMAKE_BINARY_DIR} /inklecate/linux"
21- )
7+ FetchContent_Declare (
8+ inklecate_mac
9+ URL https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_mac.zip
10+ URL_HASH SHA256=c516402bca5fa249a7712e62591b048b137eba3098c53f9fb85a4253f9b9e2c0
11+ SOURCE_DIR " ${CMAKE_BINARY_DIR} /inklecate/mac" )
12+ FetchContent_Declare (
13+ inklecate_windows
14+ URL https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_windows.zip
15+ URL_HASH SHA256=6f317cb4c59bf1b31c6dd61e80c6a2287a1d8c241a703f0586f736ae00871aab
16+ SOURCE_DIR " ${CMAKE_BINARY_DIR} /inklecate/windows" )
17+ FetchContent_Declare (
18+ inklecate_linux
19+ URL https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_linux.zip
20+ URL_HASH SHA256=26f4e188e02536d6e99e73e71d9b13e2c2144187f1368a87e82fd5066176cff8
21+ SOURCE_DIR " ${CMAKE_BINARY_DIR} /inklecate/linux" )
2222set (FETCHCONTENT_QUIET OFF )
2323mark_as_advanced (FETCHCONTENT_QUIET )
2424set (CMAKE_TLS_VERIFY true )
@@ -42,82 +42,108 @@ enable_testing()
4242
4343# Project setup
4444project (inkcpp VERSION 0.1.9)
45- SET (CMAKE_CXX_STANDARD 17)
46- SET (CMAKE_CXX_STANDARD_REQUIRED ON )
47- SET (CMAKE_INSTALL_LIBRARY_DIR lib)
48- SET (CMAKE_INSTALL_INCLUDE_DIR include)
45+ set (CMAKE_CXX_STANDARD 17)
46+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
47+ set (CMAKE_INSTALL_LIBRARY_DIR lib)
48+ set (CMAKE_INSTALL_INCLUDE_DIR include)
4949
5050# Add subdirectories
5151include (CMakeDependentOption )
5252option (INKCPP_PY "Build python bindings" OFF )
53- cmake_dependent_option (WHEEL_BUILD "Set for build wheel python lib. (see setup.py for ussage)" OFF "INKCPP_PY" OFF )
53+ cmake_dependent_option (WHEEL_BUILD "Set for build wheel python lib. (see setup.py for ussage)" OFF
54+ "INKCPP_PY" OFF )
5455option (INKCPP_C "Build c library" OFF )
55- option (INKCPP_TEST "Build inkcpp tests (requires: inklecate in path / env: INKLECATE set / INKCPP_INKLECATE=OS or ALL)" OFF )
56- set (INKCPP_INKLECATE "NONE" CACHE STRING "If inklecate should be downloaded automatically from the official release page. NONE -> No, OS -> Yes, but only for the current OS, ALL -> Yes, for all availible OSs" )
56+ option (INKCPP_TEST "Build inkcpp tests (requires: inklecate in path / env: INKLECATE set \
57+ / INKCPP_INKLECATE=OS or ALL)" OFF )
58+ set (INKCPP_INKLECATE
59+ "NONE"
60+ CACHE STRING "If inklecate should be downloaded automatically from the official release page. \
61+ NONE -> No, OS -> Yes, but only for the current OS, ALL -> Yes, for all availible OSs" )
5762set_property (CACHE INKCPP_INKLECATE PROPERTY STRINGS "NONE" "OS" "ALL" )
63+ option (INKCPP_NO_EH "Disable try/catch in runtime. Used to build without error handling." OFF )
64+ option (INKCPP_NO_RTTI
65+ "Disable real time type information depended code. Used to build without RTTI." OFF )
66+
67+ if (INKCPP_NO_EH)
68+ add_definitions (-DINKCPP_NO_EH )
69+ endif ()
70+ if (INKCPP_NO_RTTI)
71+ add_definitions (-DINKCPP_NO_RTTI )
72+ endif ()
5873
5974string (TOUPPER "${INKCPP_INKLECATE} " inkcpp_inklecate_upper)
60- if (inkcpp_inklecate_upper STREQUAL "ALL" )
75+ if (inkcpp_inklecate_upper STREQUAL "ALL" )
6176 FetchContent_MakeAvailable (inklecate_windows inklecate_mac inklecate_linux)
62- elseif (inkcpp_inklecate_upper STREQUAL "OS" )
77+ elseif (inkcpp_inklecate_upper STREQUAL "OS" )
6378 if (UNIX AND NOT APPLE )
6479 FetchContent_MakeAvailable (inklecate_linux)
6580 elseif (APPLE )
6681 FetchContent_MakeAvailable (inklecate_mac)
67- elseif (MSYS OR MINGW OR WIN32 OR CYGWIN )
82+ elseif (
83+ MSYS
84+ OR MINGW
85+ OR WIN32
86+ OR CYGWIN )
6887 FetchContent_MakeAvailable (inklecate_windows)
6988 else ()
70- message (FATAL_ERROR "Unable to identify OS for option INKCPP_INKLECATE=OS, please consider using NONE or ALL." )
89+ message (
90+ FATAL_ERROR
91+ "Unable to identify OS for option INKCPP_INKLECATE=OS, please consider using NONE or ALL." )
7192 endif ()
7293endif ()
7394
74- if (INKCPP_PY)
95+ if (INKCPP_PY)
7596 add_compile_options (-fPIC )
7697 add_subdirectory (inkcpp_python )
7798endif (INKCPP_PY )
7899add_subdirectory (shared )
79100add_subdirectory (inkcpp )
80101add_subdirectory (inkcpp_compiler )
81- if (INKCPP_C)
102+ if (INKCPP_C)
82103 add_subdirectory (inkcpp_c )
83104endif (INKCPP_C )
84- if (NOT WHEEL_BUILD)
105+ if (NOT WHEEL_BUILD)
85106 add_subdirectory (inkcpp_cl )
86107 if (INKCPP_TEST)
87108 add_subdirectory (inkcpp_test )
88109 endif (INKCPP_TEST )
89110 add_subdirectory (unreal )
90111endif (NOT WHEEL_BUILD )
91112
92-
93- install ( TARGETS inkcpp inkcpp_shared inkcpp_compiler
113+ install (
114+ TARGETS inkcpp inkcpp_shared inkcpp_compiler
94115 EXPORT inkcppTarget
95116 ARCHIVE DESTINATION "lib/ink"
96- COMPONENT lib EXCLUDE_FROM_ALL
97- PUBLIC_HEADER DESTINATION "include/ink"
98- COMPONENT lib EXCLUDE_FROM_ALL
99- )
117+ COMPONENT lib
118+ EXCLUDE_FROM_ALL
119+ PUBLIC_HEADER
120+ DESTINATION "include/ink"
121+ COMPONENT lib
122+ EXCLUDE_FROM_ALL )
100123
101- install (EXPORT inkcppTarget
102- FILE inkcppTargets.cmake DESTINATION "lib/cmake/inkcpp"
103- COMPONENT lib EXCLUDE_FROM_ALL )
124+ install (
125+ EXPORT inkcppTarget
126+ FILE inkcppTargets.cmake
127+ DESTINATION "lib/cmake/inkcpp"
128+ COMPONENT lib
129+ EXCLUDE_FROM_ALL )
104130
105131include (CMakePackageConfigHelpers )
106- configure_package_config_file (${CMAKE_CURRENT_SOURCE_DIR} /Config.cmake.in
107- "${CMAKE_CURRENT_BINARY_DIR} /inkcppConfig.cmake"
132+ configure_package_config_file (
133+ ${CMAKE_CURRENT_SOURCE_DIR} /Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR} /inkcppConfig.cmake"
108134 INSTALL_DESTINATION "lib/cmake/inkcpp"
109- NO_SET_AND_CHECK_MACRO
110- NO_CHECK_REQUIRED_COMPONENTS_MACRO )
135+ NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO )
111136write_basic_package_version_file (
112137 "${CMAKE_CURRENT_BINARY_DIR} /inkcppConfigVersion.cmake"
113138 VERSION "${inkcpp_VERSION_MAJOR} .${inkcpp_VERSION_MINOR} "
114139 COMPATIBILITY AnyNewerVersion )
115- install (FILES
116- ${CMAKE_CURRENT_BINARY_DIR} /inkcppConfig.cmake
117- ${CMAKE_CURRENT_BINARY_DIR} /inkcppConfigVersion.cmake
118- DESTINATION lib/cmake/inkcpp COMPONENT lib EXCLUDE_FROM_ALL )
119- export (EXPORT inkcppTarget
120- FILE "${CMAKE_CURRENT_BINARY_DIR} /inkcppTargets.cmake" )
140+ install (
141+ FILES ${CMAKE_CURRENT_BINARY_DIR} /inkcppConfig.cmake
142+ ${CMAKE_CURRENT_BINARY_DIR} /inkcppConfigVersion.cmake
143+ DESTINATION lib/cmake/inkcpp
144+ COMPONENT lib
145+ EXCLUDE_FROM_ALL )
146+ export (EXPORT inkcppTarget FILE "${CMAKE_CURRENT_BINARY_DIR} /inkcppTargets.cmake" )
121147
122148# include(InstallRequiredSystemLibraries)
123149set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR} /LICENSE.txt" )
@@ -130,78 +156,103 @@ set(CPACK_COMPONENTS_GROUPING IGNORE)
130156include (CPack )
131157
132158if (NOT WHEEL_BUILD)
133- find_package (Doxygen )
134- if (DOXYGEN_FOUND)
135- option (INKCPP_DOC_BlueprintUE "Building doxygen documentation with BlueprintUE visualisation for unreal blueprints. (Requires node js)" ON )
136- if (INKCPP_DOC_BlueprintUE)
137- set (NODEJS_HINT "None" CACHE PATH "Directory of NodeJS executable to use for generating BlueprintUE visualisation." )
138- if (IS_DIRECTORY "${NODEJS_HINT} " )
139- find_program (NODEJS_PATH node HINTS ${NODEJS_HINT} DOC "NodeJS executable to build BlueprintUE visualisation in documentation." )
140- else ()
141- find_program (NODEJS_PATH node DOC "NodeJS executable to build BlueprintUE visualisation in documentation." )
142- endif (IS_DIRECTORY "${NODEJS_HINT} " )
143- if ("${NODEJS_PATH} " STREQUAL "NODEJS-NOTFOUND" )
144- message (SEND_ERROR "NodeJS is required to build BlueprintUE visualisation. But it was not found. Install NodeJS set NODEJS_HINT to a directory containing the executable. Or disable building the visualisation with setting INKCPP_DOC_BlueprintUE=OFF" )
145- endif ("${NODEJS_PATH} " STREQUAL "NODEJS-NOTFOUND" )
146- endif (INKCPP_DOC_BlueprintUE )
159+ find_package (Doxygen )
160+ if (DOXYGEN_FOUND)
161+ option (INKCPP_DOC_BlueprintUE
162+ "Building doxygen documentation with BlueprintUE visualisation for unreal blueprints. \
163+ (Requires node js)" ON )
164+ if (INKCPP_DOC_BlueprintUE)
165+ set (NODEJS_HINT
166+ "None"
167+ CACHE PATH
168+ "Directory of NodeJS executable to use for generating BlueprintUE visualisation." )
169+ if (IS_DIRECTORY "${NODEJS_HINT} " )
170+ find_program (
171+ NODEJS_PATH node
172+ HINTS ${NODEJS_HINT}
173+ DOC "NodeJS executable to build BlueprintUE visualisation in documentation." )
174+ else ()
175+ find_program (NODEJS_PATH node
176+ DOC "NodeJS executable to build BlueprintUE visualisation in documentation." )
177+ endif (IS_DIRECTORY "${NODEJS_HINT} " )
178+ if ("${NODEJS_PATH} " STREQUAL "NODEJS-NOTFOUND" )
179+ message (
180+ SEND_ERROR
181+ "NodeJS is required to build BlueprintUE visualisation. \
182+ But it was not found. Install NodeJS set NODEJS_HINT \
183+ to a directory containing the executable. \
184+ Or disable building the visualisation with setting INKCPP_DOC_BlueprintUE=OFF" )
185+ endif ("${NODEJS_PATH} " STREQUAL "NODEJS-NOTFOUND" )
186+ endif (INKCPP_DOC_BlueprintUE )
147187
148- set (DOXYGEN_PROJECT_NAME ${PROJECT_NAME} )
149- # enable if update to cmake version 3.28
150- # doxygen_add_docs(doc WORKING_DIR ${PROJECT_SOURCE_DIR} CONFIG_FILE "${PROJECT_SOURCE_DIR}/Doxyfile" COMMENT "Generate docs")
151- set (INPUT_FILTER "" )
188+ set (DOXYGEN_PROJECT_NAME ${PROJECT_NAME} )
189+ # enable if update to cmake version 3.28 doxygen_add_docs(doc WORKING_DIR ${PROJECT_SOURCE_DIR}
190+ # CONFIG_FILE "${PROJECT_SOURCE_DIR}/Doxyfile" COMMENT "Generate docs")
191+ set (INPUT_FILTER "" )
152192
153- if (INKCPP_DOC_BlueprintUE AND NOT "${NODEJS_PATH} " STREQUAL "NODEJS-NOTFOUND" )
154- # TODO: make as dependecy
155- file (COPY "${PROJECT_SOURCE_DIR} /unreal/blueprint_filter.js" DESTINATION ${PROJECT_BINARY_DIR} )
156- # file(DOWNLOAD
157- # "https://raw.githubusercontent.com/blueprintue/blueprintue-self-hosted-edition/main/www/bue-render/render.css"
158- # "${PROJECT_BINARY_DIR}/render.css"
159- # EXPECTED_HASH SHA256=875364e36f8aa5d6c1d41d58043f13b48a499b5c969e8daef35bd29bbf7c6e8d)
160- file (COPY "${PROJECT_SOURCE_DIR} /unreal/render.css" DESTINATION ${PROJECT_BINARY_DIR} )
161- file (APPEND "${PROJECT_BINARY_DIR} /render.css" ".bue-render .icon { background-color: unset; }" )
162- file (READ "${PROJECT_SOURCE_DIR} /Doxyfile" DOXYFILE )
163- string (REPLACE "FILTER_PATTERNS =" "FILTER_PATTERNS = \" */unreal/*=node ${PROJECT_BINARY_DIR} /blueprint_filter.js\" " DOXYFILE2 ${DOXYFILE} )
164- string (REPLACE "HTML_EXTRA_STYLESHEET =" "HTML_EXTRA_STYLESHEET = ${PROJECT_BINARY_DIR} /render.css " DOXYFILE ${DOXYFILE2} )
165- file (WRITE "${PROJECT_BINARY_DIR} /Doxyfile" ${DOXYFILE} )
166- else ()
167- configure_file (
168- "${PROJECT_SOURCE_DIR} /Doxyfile"
169- "${PROJECT_BINARY_DIR} /Doxyfile"
170- COPYONLY )
171- endif ()
172- # "Build Doxygen documentation in ${PROJECT_SOURCE_DIR}/Documentation." "To view them you can for example use" "'python -m http.server -d \"${PROJECT_SOURCE_DIR}/Documentation\" 8080'" "'explorer http://localhost:8080/html'"
173- add_custom_target (doc
174- ${DOXYGEN_EXECUTABLE} "${PROJECT_BINARY_DIR} /Doxyfile"
175- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR} "
176- COMMAND ${CMAKE_COMMAND} -E echo
177- COMMENT "Generate DoxygenDocumentation" )
178- add_custom_command (TARGET doc POST_BUILD
179- COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan
180- "Build Doxygen documentation in ${PROJECT_SOURCE_DIR} /Documentation."
181- "To view them you can for example use"
182- "\" python -m http.server -d \\\" ${PROJECT_SOURCE_DIR} /Documentation\\\" 8080\" "
183- " explorer http://localhost:8080/html" )
193+ if (INKCPP_DOC_BlueprintUE AND NOT "${NODEJS_PATH} " STREQUAL "NODEJS-NOTFOUND" )
194+ # TODO: make as dependecy
195+ file (COPY "${PROJECT_SOURCE_DIR} /unreal/blueprint_filter.js"
196+ DESTINATION ${PROJECT_BINARY_DIR} )
197+ # file(DOWNLOAD "https://raw.githubusercontent.com/blueprintue/ \
198+ # blueprintue-self-hosted-edition/main/www/bue-render/render.css"
199+ # "${PROJECT_BINARY_DIR}/render.css" EXPECTED_HASH
200+ # SHA256=875364e36f8aa5d6c1d41d58043f13b48a499b5c969e8daef35bd29bbf7c6e8d)
201+ file (COPY "${PROJECT_SOURCE_DIR} /unreal/render.css" DESTINATION ${PROJECT_BINARY_DIR} )
202+ file (APPEND "${PROJECT_BINARY_DIR} /render.css"
203+ ".bue-render .icon { background-color: unset; }" )
204+ file (READ "${PROJECT_SOURCE_DIR} /Doxyfile" DOXYFILE )
205+ string (
206+ REPLACE
207+ "FILTER_PATTERNS ="
208+ "FILTER_PATTERNS = \" */unreal/*=node ${PROJECT_BINARY_DIR} /blueprint_filter.js\" "
209+ DOXYFILE2 ${DOXYFILE} )
210+ string (REPLACE "HTML_EXTRA_STYLESHEET ="
211+ "HTML_EXTRA_STYLESHEET = ${PROJECT_BINARY_DIR} /render.css " DOXYFILE
212+ ${DOXYFILE2} )
213+ file (WRITE "${PROJECT_BINARY_DIR} /Doxyfile" ${DOXYFILE} )
214+ else ()
215+ configure_file ("${PROJECT_SOURCE_DIR} /Doxyfile" "${PROJECT_BINARY_DIR} /Doxyfile" COPYONLY )
216+ endif ()
217+ # "Build Doxygen documentation in ${PROJECT_SOURCE_DIR}/Documentation." "To view them you can
218+ # for example use" "'python -m http.server -d \"${PROJECT_SOURCE_DIR}/Documentation\" 8080'"
219+ # "'explorer http://localhost:8080/html'"
220+ add_custom_target (
221+ doc
222+ ${DOXYGEN_EXECUTABLE} "${PROJECT_BINARY_DIR} /Doxyfile"
223+ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR} "
224+ COMMAND ${CMAKE_COMMAND} -E echo
225+ COMMENT "Generate DoxygenDocumentation" )
226+ add_custom_command (
227+ TARGET doc
228+ POST_BUILD
229+ COMMENT ""
230+ COMMAND
231+ ${CMAKE_COMMAND} -E cmake_echo_color --cyan
232+ "Build Doxygen documentation in ${PROJECT_SOURCE_DIR} /Documentation."
233+ "To view them you can for example use" "\" python -m http.server -d \\\"\
234+ ${PROJECT_SOURCE_DIR} /Documentation\\\" 8080\" " " explorer http://localhost:8080/html" )
184235
185- set (PY_HTML "${PROJECT_SOURCE_DIR} /Documentation/inkcpp_py.html" )
186- if (INKCPP_PY)
187- find_package (
188- Python3
189- REQUIRED
190- COMPONENTS Interpreter
191- )
192- add_custom_target ( inkcpp_py_doc
193- python -m pybind11_stubgen -o . inkcpp_py
194- COMMAND python -m pdoc -d google -o . inkcpp_py.pyi
195- COMMAND ${CMAKE_COMMAND} -E copy "./inkcpp_py.html" ${PY_HTML}
196- DEPENDS inkcpp_py
197- WORKING_DIRECTORY $< TARGET_FILE_DIR : inkcpp_py >
198- COMMENT "Generates simple python documentation" )
199- add_dependencies ( doc inkcpp_py_doc )
200- else ( )
201- message ( WARNING "The python target is disabled, therfore no python documentation will be build. Set INKCPP_PY to change this" )
202- file ( WRITE ${PY_HTML} "<html><head></head><body><h2>Python Documenattion was not build!</h2></body></html>" )
203- endif (INKCPP_PY )
204- else (DOXYGEN_FOUND )
205- message ("Doxygen needed to generate documntation!" )
206- endif (DOXYGEN_FOUND )
236+ set (PY_HTML "${PROJECT_SOURCE_DIR} /Documentation/inkcpp_py.html" )
237+ if (INKCPP_PY)
238+ find_package (Python3 REQUIRED COMPONENTS Interpreter )
239+ add_custom_target (
240+ inkcpp_py_doc
241+ python -m pybind11_stubgen -o . inkcpp_py
242+ COMMAND python -m pdoc -d google -o . inkcpp_py.pyi
243+ COMMAND ${CMAKE_COMMAND} -E copy "./inkcpp_py.html" ${PY_HTML}
244+ DEPENDS inkcpp_py
245+ WORKING_DIRECTORY $< TARGET_FILE_DIR : inkcpp_py >
246+ COMMENT "Generates simple python documentation" )
247+ add_dependencies ( doc inkcpp_py_doc )
248+ else ()
249+ message (
250+ WARNING "The python target is disabled, therfore no python documentation will be build. \
251+ Set INKCPP_PY to change this" )
252+ file ( WRITE ${PY_HTML}
253+ "<html><head></head><body><h2>Python Documenattion was not build!</h2></body></html>" )
254+ endif (INKCPP_PY )
255+ else (DOXYGEN_FOUND )
256+ message ("Doxygen needed to generate documntation!" )
257+ endif (DOXYGEN_FOUND )
207258endif (NOT WHEEL_BUILD )
0 commit comments