chore: finish basic CMake build scripts

This commit is contained in:
2024-07-24 22:28:44 +08:00
parent a1de143ae8
commit 03f4b1b773
7 changed files with 53 additions and 13 deletions

View File

@@ -12,12 +12,12 @@ if (WIN32)
add_library(SQLite3 INTERFACE IMPORTED) add_library(SQLite3 INTERFACE IMPORTED)
add_library(SQLite3::SQLite3 ALIAS SQLite3) add_library(SQLite3::SQLite3 ALIAS SQLite3)
# Setup header files # Setup header files
set_target_properties(VirtoolsSDK PROPERTIES set_target_properties(SQLite3 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES
"${SQLITE_AMALGAMATION_PATH}" "${SQLITE_AMALGAMATION_PATH}"
) )
# Setup lib files # Setup lib files
set_target_properties(VirtoolsSDK PROPERTIES set_target_properties(SQLite3 PROPERTIES
INTERFACE_LINK_LIBRARIES INTERFACE_LINK_LIBRARIES
"${SQLITE_DLL_PATH}/sqlite3.lib" "${SQLITE_DLL_PATH}/sqlite3.lib"
) )

View File

@@ -105,12 +105,18 @@ INTERFACE_LINK_LIBRARIES
"$<$<STREQUAL:${MATERIALIZER_BUILD_TYPE},plugin>:${VIRTOOLS_LIB_PATH}/InterfaceControls.lib>" "$<$<STREQUAL:${MATERIALIZER_BUILD_TYPE},plugin>:${VIRTOOLS_LIB_PATH}/InterfaceControls.lib>"
"$<$<STREQUAL:${MATERIALIZER_BUILD_TYPE},plugin>:${VIRTOOLS_LIB_PATH}/CKControls.lib>" "$<$<STREQUAL:${MATERIALIZER_BUILD_TYPE},plugin>:${VIRTOOLS_LIB_PATH}/CKControls.lib>"
) )
# Setup build macros # Setup compile macros
set_target_properties(VirtoolsSDK PROPERTIES target_compile_definitions(VirtoolsSDK
INTERFACE_COMPILE_DEFINITIONS INTERFACE
# Virtools version macro # Virtools version macro
"VIRTOOLS_${VIRTOOLS_VERSION}" "VIRTOOLS_${VIRTOOLS_VERSION}"
# Virtools 5.0 standalone mode need an extra macro # Virtools 5.0 standalone mode need an extra macro
"$<$<AND:$<STREQUAL:${MATERIALIZER_BUILD_TYPE},plugin>,$<STREQUAL:${VIRTOOLS_VERSION},50>>:VIRTOOLS_USER_SDK" "$<$<AND:$<STREQUAL:${MATERIALIZER_BUILD_TYPE},plugin>,$<STREQUAL:${VIRTOOLS_VERSION},50>>:VIRTOOLS_USER_SDK>"
)
# Setup compiler options
target_compile_options(VirtoolsSDK
INTERFACE
# Permissive mode ordered.
"/permissive"
) )

View File

@@ -8,7 +8,7 @@ PRIVATE
) )
# Setup header files # Setup header files
target_sources(VSWDecorator target_sources(VSWDecorator
PUBLIC PRIVATE
FILE_SET HEADERS FILE_SET HEADERS
FILES FILES
# Headers # Headers
@@ -17,6 +17,16 @@ FILES
target_include_directories(VSWDecorator target_include_directories(VSWDecorator
PUBLIC PUBLIC
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
YYCCommonplace
SQLite3::SQLite3
VSWShared
)
# Setup linked library
target_link_libraries(VSWDecorator
PRIVATE
YYCCommonplace
SQLite3::SQLite3
VSWShared
) )
# Setup C++ standard # Setup C++ standard
set_target_properties(VSWDecorator set_target_properties(VSWDecorator

View File

@@ -7,24 +7,37 @@ if (VSW_MATERIALIZER_BUILD_TYPE STREQUAL "plugin")
else () else ()
add_executable(VSWMaterializer "") add_executable(VSWMaterializer "")
endif () endif ()
# Setup static library sources # Setup source files
target_sources(VSWMaterializer target_sources(VSWMaterializer
PRIVATE PRIVATE
# Sources # Sources
main.cpp main.cpp
) )
# Setup header files
target_sources(VSWMaterializer target_sources(VSWMaterializer
PUBLIC PRIVATE
FILE_SET HEADERS FILE_SET HEADERS
FILES FILES
# Headers # Headers
stdafx.hpp stdafx.hpp
resources.h resource.h
) )
# Setup header infomations # Setup header infomations
target_include_directories(VSWMaterializer target_include_directories(VSWMaterializer
PUBLIC PRIVATE
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
YYCCommonplace
SQLite3::SQLite3
VirtoolsSDK
VSWShared
)
# Setup linked library
target_link_libraries(VSWMaterializer
PRIVATE
YYCCommonplace
SQLite3::SQLite3
VirtoolsSDK
VSWShared
) )
# Setup C++ standard (we require C++ 17 because Virtools can hold more higher C++ standard) # Setup C++ standard (we require C++ 17 because Virtools can hold more higher C++ standard)
set_target_properties(VSWMaterializer set_target_properties(VSWMaterializer
@@ -36,8 +49,8 @@ PROPERTIES
# MSVC specific correction # MSVC specific correction
target_compile_definitions(VSWMaterializer target_compile_definitions(VSWMaterializer
PRIVATE PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:UNICODE> $<$<CXX_COMPILER_ID:MSVC>:MBCS>
$<$<CXX_COMPILER_ID:MSVC>:_UNICODE> $<$<CXX_COMPILER_ID:MSVC>:_MBCS>
) )
target_compile_options(VSWMaterializer target_compile_options(VSWMaterializer
PRIVATE PRIVATE

10
script/build.bat Normal file
View File

@@ -0,0 +1,10 @@
MKDIR bin
CD bin
cmake -G "Visual Studio 16 2019" -A Win32 -DVSW_BUILD_MATERIALIZER=ON -DVSW_BUILD_DECORATOR=OFF -DMATERIALIZER_BUILD_TYPE=plugin -DVIRTOOLS_VERSION=50 -DVIRTOOLS_PATH="E:\Virtools\Virtools Dev 5.0" -DSQLITE_AMALGAMATION_PATH="D:\CppLib\SQLite\sqlite-amalgamation-3450300" -DSQLITE_DLL_PATH="D:\CppLib\SQLite\sqlite-dll-win-x86-3450300" -DYYCC_PATH="J:\YYCCommonplace\bin\install\Win32_Debug" ../..
cmake --build . --config Debug
cmake -G "Visual Studio 16 2019" -A Win32 -DVSW_BUILD_MATERIALIZER=OFF -DVSW_BUILD_DECORATOR=ON -DSQLITE_AMALGAMATION_PATH="D:\CppLib\SQLite\sqlite-amalgamation-3450300" -DSQLITE_DLL_PATH="D:\CppLib\SQLite\sqlite-dll-win-x86-3450300" -DYYCC_PATH="J:\YYCCommonplace\bin\install\Win32_Debug" ../..
cmake --build . --config Debug
CD ..
ECHO Build Done!

View File

@@ -4,6 +4,7 @@ add_library(VSWShared STATIC "")
target_sources(VSWShared target_sources(VSWShared
PRIVATE PRIVATE
# Sources # Sources
DataTypes.cpp
) )
# Setup header files # Setup header files
target_sources(VSWShared target_sources(VSWShared

0
shared/DataTypes.cpp Normal file
View File