Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vlpp] Fix configure issues, export unofficial target #26887

Merged
merged 28 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 101 additions & 24 deletions ports/vlpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,122 @@ cmake_minimum_required(VERSION 3.3.0)

project(Vlpp VERSION 0.10.0.0 LANGUAGES CXX)

# Sources
set(SRCS
Import/Vlpp.cpp
Import/VlppWorkflowLibrary.cpp
Import/VlppWorkflowCompiler.cpp
Import/VlppWorkflowRuntime.cpp)
option(SKIP_HEADERS "Skip header installation" OFF)
option(WORKFLOW_LIBRARY "Use VlppWorkflowLibrary" OFF)
option(WORKFLOW_RUNTIME "Use VlppWorkflowRuntime" OFF)
option(WORKFLOW_COMPILER "Use VlppWorkflowCompiler" OFF)
option(GACUI "Use GacUI" OFF)
option(DARK_SKIN "Use DarkSkin" OFF)
option(REFLECTION "Use GacUIReflection or DarkSkinReflection" OFF)
cmake_dependent_option(GACUI_REFLECTION "Use GacUIReflection" ON "GACUI;REFLECTION" OFF)
cmake_dependent_option(DARK_SKIN_REFLECTION "Use GacUIReflection" ON "DARK_SKIN;REFLECTION" OFF)
option(BUILD_GACUI_COMPILER "Build GacUICompiler" OFF)

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
set(CMAKE_CXX_STANDARD 20)

# library
set(CORE_HDRS
Import/Vlpp.h
Import/VlppOS.h
Import/VlppGlrParser.h
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
Import/VlppRegex.h
)
set(CORE_SRCS
Import/Vlpp.cpp
Import/VlppOS.cpp
Import/VlppGlrParser.cpp
Import/VlppRegex.cpp
)

if (WIN32)
list(APPEND CORE_SRCS Import/Vlpp.Windows.cpp Import/VlppOS.Windows.cpp)
else()
list(APPEND CORE_SRCS Import/Vlpp.Linux.cpp Import/VlppOS.Linux.cpp)
endif()

if (WORKFLOW_LIBRARY)
list(APPEND CORE_HDRS Import/VlppWorkflowLibrary.h)
list(APPEND CORE_SRCS Import/VlppWorkflowLibrary.cpp)
endif()

if (WORKFLOW_RUNTIME)
list(APPEND CORE_HDRS Import/VlppWorkflowRuntime.h)
list(APPEND CORE_SRCS Import/VlppWorkflowRuntime.cpp)
endif()

if (WORKFLOW_COMPILER)
list(APPEND CORE_HDRS Import/VlppWorkflowCompiler.h)
list(APPEND CORE_SRCS Import/VlppWorkflowCompiler.cpp)
endif()

if (GACUI)
set(GACUI_SRCS Import/GacUI.cpp Import/GacUI.Windows.cpp)
if (GACUI_REFLECTION)
list(APPEND CORE_HDRS Import/VlppReflection.h)
list(APPEND GACUI_SRCS Import/GacUIReflection.cpp Import/VlppReflection.cpp)
endif()
if (NOT GACUI_REFLECTION)
list(APPEND EXTRA_DEFINES VCZH_DEBUG_NO_REFLECTION)
endif()
list(APPEND CORE_SRCS ${GACUI_SRCS})
endif()

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
if (DARK_SKIN)
set(DARK_SKIN_SRCS Import/Skins/DarkSkin/DarkSkin.cpp)
if (DARK_SKIN_REFLECTION)
list(APPEND CORE_HDRS Import/VlppReflection.h)
list(APPEND DARK_SKIN_SRCS Import/Skins/DarkSkin/DarkSkinReflection.cpp Import/VlppReflection.cpp)
endif()
list(APPEND EXTRA_INCLUDES Import/Skins/DarkSkin)
if (NOT DARK_SKIN_REFLECTION)
list(APPEND EXTRA_DEFINES VCZH_DEBUG_NO_REFLECTION)
endif()
list(APPEND CORE_SRCS ${DARK_SKIN_SRCS})
endif()

# Create and configure the target
add_library(Vlpp ${SRCS})
list(REMOVE_DUPLICATES CORE_HDRS)
list(REMOVE_DUPLICATES CORE_SRCS)

add_library(Vlpp STATIC ${CORE_SRCS})

# target_compile_definitions
target_compile_definitions(Vlpp PRIVATE UNICODE)
target_compile_definitions(Vlpp PRIVATE _UNICODE)

target_include_directories(Vlpp PRIVATE ${PROJECT_SOURCE_DIR}/Import)
if (EXTRA_DEFINES)
target_compile_definitions(Vlpp PUBLIC ${EXTRA_DEFINES})
endif()

if(MSVC)
target_compile_options(Vlpp PRIVATE /bigobj)
endif()

if (EXTRA_INCLUDES)
target_include_directories(Vlpp PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/${EXTRA_INCLUDES}> $<INSTALL_INTERFACE:${EXTRA_INCLUDES}>)
endif()
target_include_directories(Vlpp PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Import> $<INSTALL_INTERFACE:Import>)

# Tool
if (BUILD_GACUI_COMPILER)
add_executable(GacGen Import/GacUICompiler.cpp)

install(TARGETS GacGen RUNTIME DESTINATION "bin")
endif()

# Install
install(
TARGETS Vlpp
EXPORT unofficial-vlpp
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
)

if (NOT DEFINED SKIP_HEADERS)
install(
FILES
Import/Vlpp.h
Import/VlppWorkflowLibrary.h
Import/VlppWorkflowCompiler.h
Import/VlppWorkflowRuntime.h
DESTINATION "include"
)
)

install(EXPORT unofficial-vlpp
NAMESPACE unofficial::vlpp::
DESTINATION share/unofficial-vlpp
)

if (NOT SKIP_HEADERS)
install(FILES ${CORE_HDRS} DESTINATION "include")
endif()
27 changes: 10 additions & 17 deletions ports/vlpp/fix-arm.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
diff --git a/Import/Vlpp.h b/Import/Vlpp.h
index cf59b80..b00c9b8 100644
--- a/Import/Vlpp.h
+++ b/Import/Vlpp.h
@@ -50,13 +50,12 @@
#define abstract
@@ -49,10 +49,10 @@ static_assert(sizeof(wchar_t) == sizeof(char32_t), "wchar_t is not UTF-32.");
static_assert(false, "wchar_t configuration is not right.");
#endif
-
+#include <stdlib.h>
#if defined VCZH_MSVC
#include <intrin.h>
Expand All @@ -12,23 +14,14 @@
#include <stdint.h>
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
#include <stddef.h>
#include <wchar.h>
#define abstract
#define __thiscall
#define __forceinline inline
@@ -160,14 +159,14 @@
#define UI64TOA_S _ui64toa_s
#define UI64TOW_S _ui64tow_s
#if defined VCZH_MSVC
#define INCRC(x) (_InterlockedIncrement((volatile long*)(x)))
#define DECRC(x) (_InterlockedDecrement((volatile long*)(x)))
@@ -149,8 +149,8 @@ x86 and x64 Compatbility
#define INCRC(x) (_InterlockedIncrement64(x))
#define DECRC(x) (_InterlockedDecrement64(x))
#elif defined VCZH_GCC
-#define INCRC(x) (__sync_add_and_fetch(x, 1))
-#define DECRC(x) (__sync_sub_and_fetch(x, 1))
+#define INCRC(x) (__atomic_add_fetch(x, 1, __ATOMIC_SEQ_CST))
+#define DECRC(x) (__atomic_sub_fetch(x, 1, __ATOMIC_SEQ_CST))
#endif
#endif

/***********************************************************************
Basic Types
***********************************************************************/
#else
#define ITOA_S _itoa_s
29 changes: 24 additions & 5 deletions ports/vlpp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,44 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO vczh-libraries/Release
REF 5dfe25c4f4997da2d7a23bdc80c2438e72d9813a # 0.11.0.0
SHA512 5d585e561246385b074c625a3644b79defa22328dab0ab14112c846cb917f384abb617a5f400971ca29e4ee5ac391b88b17ee65d594caf9ebf279806db669a4a
REF 0a7bf9b4f7e705f17efc2ada5aa2b089147234d4 # 1.1.0.0
SHA512 b70081495f2843a45ea2aea37a2d00327e336a3313acfa20421de4748c880905279353c03ecc50f45e9cda0aae34aad69ba44de81fa2fd4d4855be6002dd068f
HEAD_REF master
PATCHES fix-arm.patch
)

file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
workflowlibrary WORKFLOW_LIBRARY
workflowruntime WORKFLOW_RUNTIME
workflowcompiler WORKFLOW_COMPILER
gacui GACUI
darkskin DARK_SKIN
reflection REFLECTION
tool BUILD_GACUI_COMPILER
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DSKIP_HEADERS=ON
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-vlpp)

if (BUILD_GACUI_COMPILER)
vcpkg_copy_tools(TOOL_NAMES GacGen)
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

# Tools
file(INSTALL "${SOURCE_PATH}/Tools/CppMerge.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/tools")

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/vlpp" RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
33 changes: 30 additions & 3 deletions ports/vlpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
{
"name": "vlpp",
"version": "0.11.0.0",
"port-version": 3,
"version": "1.1.0.0",
"description": "Common C++ construction, including string operation / generic container / linq / General-LR parser generator / multithreading / reflection for C++ / etc",
"homepage": "https://github.com/vczh-libraries/Release",
"license": null,
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"darkskin": {
"description": "Use DarkSkin"
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
},
"gacui": {
"description": "Use GacUI"
},
"reflection": {
"description": "Use GacUIReflection or DarkSkinReflection"
},
"tool": {
"description": "Build GacUICompiler"
},
"workflowcompiler": {
"description": "Use VlppWorkflowCompiler"
},
"workflowlibrary": {
"description": "Use VlppWorkflowLibrary"
},
"workflowruntime": {
"description": "Use VlppWorkflowRuntime"
}
]
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7666,7 +7666,7 @@
},
"vlpp": {
"baseline": "0.11.0.0",
"port-version": 3
"port-version": 4
},
"volk": {
"baseline": "1.3.204",
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vlpp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d593e711f4b1ee56e84b9cfe4fab3bcc79fc602e",
"version": "0.11.0.0",
"port-version": 4
},
{
"git-tree": "b4f56db04c13b5bf335e4e5939617596e15e89ac",
"version": "0.11.0.0",
Expand Down