chore: update build script
- change project layout for better understanding. - update build script for more close to standard cmake way.
This commit is contained in:
23
.gitignore
vendored
23
.gitignore
vendored
@@ -1,22 +1,25 @@
|
||||
# -------------------- Personal --------------------
|
||||
## ======== Personal ========
|
||||
# Ignore build resources
|
||||
out/
|
||||
build/
|
||||
install/
|
||||
extern/
|
||||
temp/
|
||||
|
||||
# Ignore all possible test used Virtools files
|
||||
*.nmo
|
||||
*.cmo
|
||||
*.nms
|
||||
*.vmo
|
||||
|
||||
# Ignore CMake generated version header
|
||||
LibCmo/VTVersion.hpp
|
||||
|
||||
# Ignore temporary Visual Studio files and folders
|
||||
temp/
|
||||
out/
|
||||
# Ignore CMake generated stuff
|
||||
LibCmo/LibCmo/VTVersion.hpp
|
||||
CMakeSettings.json
|
||||
|
||||
# -------------------- VSCode --------------------
|
||||
## ======== VSCode ========
|
||||
.vscode/
|
||||
|
||||
# -------------------- CMake --------------------
|
||||
## ======== CMake ========
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
@@ -29,7 +32,7 @@ compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
# -------------------- Visual Studio --------------------
|
||||
## ======== Visual Studio ========
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
|
||||
@@ -25,31 +25,13 @@ PRIVATE
|
||||
YYCC::YYCCommonplace
|
||||
LibCmo
|
||||
)
|
||||
# Setup C++ standard
|
||||
set_target_properties(BMap
|
||||
PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
CXX_STANDARD_REQUIRED 20
|
||||
CXX_EXTENSION OFF
|
||||
)
|
||||
# Setup project macros
|
||||
target_compile_definitions(BMap
|
||||
# Enable export macro
|
||||
target_compile_definitions(BMap
|
||||
PRIVATE
|
||||
BMAP_EXPORTING
|
||||
# Order Unicode charset for private using
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:UNICODE>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:_UNICODE>
|
||||
)
|
||||
# Order build as UTF-8 in MSVC
|
||||
target_compile_options(BMap
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
||||
)
|
||||
|
||||
# Install BMap only on Release mode
|
||||
# Install BMap
|
||||
install(TARGETS BMap
|
||||
CONFIGURATIONS Release RelWithDebInfo MinSizeRel
|
||||
RUNTIME DESTINATION ${YYCC_INSTALL_BIN_PATH}
|
||||
RUNTIME DESTINATION ${NEMO_INSTALL_BIN_PATH}
|
||||
)
|
||||
|
||||
52
CMake/FindSTB.cmake
Normal file
52
CMake/FindSTB.cmake
Normal file
@@ -0,0 +1,52 @@
|
||||
# - Find STB library
|
||||
# Find the STB headers
|
||||
#
|
||||
# This module defines the following variables:
|
||||
# STB_FOUND - True if STB was found
|
||||
# STB_INCLUDE_DIRS - Location of the STB headers
|
||||
#
|
||||
# This module defines the following imported targets:
|
||||
# STB::STB - Header-only interface library for STB
|
||||
|
||||
# STB_ROOT must be specified by the user
|
||||
if (NOT DEFINED STB_ROOT)
|
||||
set(STB_FOUND FALSE)
|
||||
else ()
|
||||
# Look for STB_image.h in the specified STB_ROOT directory
|
||||
find_path(STB_INCLUDE_DIR
|
||||
NAMES STB_image.h
|
||||
HINTS ${STB_ROOT}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# Check find status
|
||||
if(STB_INCLUDE_DIR)
|
||||
set(STB_FOUND TRUE)
|
||||
set(STB_INCLUDE_DIRS ${STB_INCLUDE_DIR})
|
||||
else()
|
||||
set(STB_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
# Hide intermediate variables
|
||||
mark_as_advanced(STB_INCLUDE_DIR)
|
||||
endif ()
|
||||
|
||||
# Check find result
|
||||
if (STB_FOUND)
|
||||
# Add library
|
||||
message(STATUS "Found STB library")
|
||||
# Add library
|
||||
add_library(STB INTERFACE IMPORTED)
|
||||
# Add alias to it
|
||||
add_library(STB::STB ALIAS STB)
|
||||
# Setup header files
|
||||
set_target_properties(STB PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${STB_INCLUDE_DIRS}"
|
||||
)
|
||||
else ()
|
||||
# If it is required, show infomations.
|
||||
if (std_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Fail to find STB library.")
|
||||
endif ()
|
||||
endif ()
|
||||
@@ -1,9 +0,0 @@
|
||||
if (WIN32)
|
||||
# In Windows, we should not import Iconv.
|
||||
# Send a notice to programmer.
|
||||
message("Windows environment detected, skip finding Iconv!")
|
||||
else ()
|
||||
# In non-Windows, we simply import Iconv from CMake preset.
|
||||
# It will produce Iconv::Iconv target for including and linking.
|
||||
find_package(Iconv REQUIRED)
|
||||
endif ()
|
||||
@@ -1,14 +0,0 @@
|
||||
# Check stb path variable
|
||||
if (NOT DEFINED STB_IMAGE_PATH)
|
||||
message(FATAL_ERROR "You must set STB_IMAGE_PATH variable to the root directory of std-image repository.")
|
||||
endif()
|
||||
|
||||
# Add library
|
||||
add_library(stb-image INTERFACE IMPORTED)
|
||||
# Add alias for it
|
||||
add_library(stb::stb-image ALIAS stb-image)
|
||||
# Setup header files
|
||||
set_target_properties(stb-image PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${STB_IMAGE_PATH}"
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
# Check YYCC path environment variable
|
||||
if (NOT DEFINED YYCC_PATH)
|
||||
message(FATAL_ERROR "You must set YYCC_PATH variable to one of YYCC CMake distribution installation path.")
|
||||
endif()
|
||||
|
||||
# Find YYCC library
|
||||
# It will produce YYCC::YYCCommonplace target for including and linking.
|
||||
#
|
||||
# Please note we MUST set CMake variable YYCCommonplace_ROOT to make sure CMake can found YYCC in out given path.
|
||||
# The cache status of YYCCommonplace_ROOT is doesn't matter.
|
||||
# CMake will throw error if we use HINTS feature in find_package to find YYCC.
|
||||
set(YYCCommonplace_ROOT ${YYCC_PATH} CACHE PATH
|
||||
"The path to YYCC CMake distribution installation path.")
|
||||
find_package(YYCCommonplace REQUIRED)
|
||||
@@ -1,34 +0,0 @@
|
||||
if (WIN32)
|
||||
# In Windows, we use custom way to import ZLib.
|
||||
# Before using this CMake file in Windows, you should do following steps first.
|
||||
# 1. Get ZLib repository: https://github.com/madler/zlib
|
||||
# 2. Navigate to `contrib/vstudio` and choose a proper Visual Studio project according to your environment.
|
||||
# 3. Open project file and build. Then you will get the built binary.
|
||||
# 4. The directory binary located is the argument you should passed to ZLIB_BINARY_PATH, for example: `contrib/vstudio/vc14/x64/ZlibDllRelease`
|
||||
|
||||
# Check ZLib path variable
|
||||
if (NOT DEFINED ZLIB_HEADER_PATH)
|
||||
message(FATAL_ERROR "You must set ZLIB_HEADER_PATH to the root directory of ZLib repository.")
|
||||
endif()
|
||||
if (NOT DEFINED ZLIB_BINARY_PATH)
|
||||
message(FATAL_ERROR "You must set ZLIB_BINARY_PATH to the directory where include binary built by contributed Visual Studio project.")
|
||||
endif()
|
||||
# Add imported library
|
||||
add_library(ZLIB INTERFACE IMPORTED)
|
||||
# Add alias for it to let it has the same behavior with CMake imported ZLib.
|
||||
add_library(ZLIB::ZLIB ALIAS ZLIB)
|
||||
# Setup header files
|
||||
set_target_properties(ZLIB PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${ZLIB_HEADER_PATH}"
|
||||
)
|
||||
# Setup lib files
|
||||
set_target_properties(ZLIB PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES
|
||||
"${ZLIB_BINARY_PATH}/zlibwapi.lib"
|
||||
)
|
||||
else ()
|
||||
# In non-Windows, we simply import ZLib from CMake preset.
|
||||
# It will produce ZLIB::ZLIB target for including and linking.
|
||||
find_package(ZLIB REQUIRED)
|
||||
endif ()
|
||||
@@ -1,6 +1,8 @@
|
||||
# Minimum required CMake version
|
||||
cmake_minimum_required(VERSION 3.23)
|
||||
# Project definition
|
||||
project(NeMo
|
||||
VERSION 0.3.0
|
||||
VERSION 0.4.0
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
@@ -9,6 +11,11 @@ option(NEMO_BUILD_UNVIRT "Build Unvirt, the console interface operator of LibCmo
|
||||
option(NEMO_BUILD_BMAP "Build BMap, the example use of LibCmo which can read and write Ballance game map." OFF)
|
||||
option(NEMO_BUILD_DOC "Build document of LibCmo and all related stuff." OFF)
|
||||
|
||||
# Set C++ standards
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Setup install path from CMake provided install path for convenient use.
|
||||
include(GNUInstallDirs)
|
||||
set(NEMO_INSTALL_INCLUDE_PATH ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH
|
||||
@@ -20,11 +27,14 @@ set(NEMO_INSTALL_BIN_PATH ${CMAKE_INSTALL_BINDIR} CACHE PATH
|
||||
set(NEMO_INSTALL_DOC_PATH ${CMAKE_INSTALL_DOCDIR} CACHE PATH
|
||||
"Non-arch doc install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
||||
|
||||
# Import essential packages
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_zlib.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_iconv.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_yycc.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_stb.cmake)
|
||||
# Add our CMake in module found path
|
||||
set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_LIST_DIR}/CMake"
|
||||
)
|
||||
# Find required packages
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(YYCCommonplace REQUIRED)
|
||||
find_package(STB REQUIRED)
|
||||
|
||||
# If we are not in Windows environment, and we need to build shared library BMap,
|
||||
# we should enable PIC (position independent code), otherwise build process will fail.
|
||||
@@ -36,7 +46,7 @@ if ((NOT WIN32) AND NEMO_BUILD_BMAP)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE True)
|
||||
endif ()
|
||||
|
||||
# Import build targets
|
||||
# Include build targets by options
|
||||
add_subdirectory(LibCmo)
|
||||
if (NEMO_BUILD_UNVIRT)
|
||||
add_subdirectory(Unvirt)
|
||||
|
||||
152
COMPILE.md
152
COMPILE.md
@@ -1,35 +1,43 @@
|
||||
# Compile Manual
|
||||
|
||||
## Choose Version
|
||||
|
||||
We suggest that you only use stable version (tagged commit).
|
||||
The latest commit always present current works.
|
||||
It means that it is not stable and work in progress.
|
||||
|
||||
## Requirements
|
||||
|
||||
This project require:
|
||||
|
||||
* CMake 3.23 at least.
|
||||
* The common compiler supporting C++ 20 (GCC / Clang / MSVC).
|
||||
* The common compiler supporting C++ 23 (GCC / Clang / MSVC).
|
||||
* Littile-endian architecture system.
|
||||
* zlib.
|
||||
* iconv (non-Windows system required).
|
||||
* [stb](https://github.com/nothings/stb): For image read and write.
|
||||
* [YYCCommonplace](https://github.com/yyc12345/YYCCommonplace): My personal invented library concentrating some common functions for mine.
|
||||
|
||||
Since libcmo21 0.2.0, we only provide it in CMake build system. So Windows user should install CMake first or use Visual Studio directly (Visual Studio provides CMake build system supports).
|
||||
* [stb](https://github.com/nothings/stb).
|
||||
* [YYCCommonplace](https://github.com/yyc12345/YYCCommonplace).
|
||||
* Doxygen (Required if you build documentation).
|
||||
|
||||
## Preparations
|
||||
|
||||
### YYCCommonplace
|
||||
|
||||
You should clone YYCCommonplace and switch to the latest release tag (or specified commit hash provided with libcmo21 release infos if you are building for specific libcmo21 version). When configuring YYCCommonplace, you should notice following infos:
|
||||
Following these steps to prepare YYCCommonplace:
|
||||
|
||||
* Please make sure that you have specified C++ 20 explicitly by passing `-DCMAKE_CXX_STANDARD=20` in command line. This is crucial because libcmo21 use C++ 20, and YYCCommonplace's ABI is incompatible between C++ 17 version and C++ 20 version.
|
||||
* If you need `BMap` in final libcmo21 built artifacts, and you are in non-Windows system now, please specify position independent code flag by passing `-DCMAKE_POSITION_INDEPENDENT_CODE=True` in command line. GCC and Clang will reject linking if you don't flag it.
|
||||
1. Clone YYCCommonplace first.
|
||||
1. Switch to the latest **release** tag, or **specified commit hash** provided with libcmo21 release infos if you are building for specific libcmo21 version.
|
||||
1. Following compile manual provided by YYCCommonplace to configure, compile and install it.
|
||||
|
||||
After configuring, you can normally build YYCCommonplace like a common CMake project.
|
||||
|
||||
Please note if your final program or dynamic library is provided for end user, please choose `RelWithDebInfo` build type (`Release` is not suggested because it will strip all debug infos and it is not good for bug reporter, which is embedded in program, to report crash). If final program is served for programmer debugging, please choose `Debug` build type.
|
||||
> [!IMPORTANT]
|
||||
> If you need `BMap` component in final libcmo21 built artifacts, and you are in non-Windows system now, please specify position independent code flag by passing `-DCMAKE_POSITION_INDEPENDENT_CODE=True` in command line when configuring YYCCommonplace. Otherwise GCC and Clang will reject linking.
|
||||
|
||||
### stb
|
||||
|
||||
You should clone stb repository first, then switch to a specific commit hash `2e2bef463a5b53ddf8bb788e25da6b8506314c08`. In ideally scenario, people like to choose the latest commit. However, I not frequently update this dependency.
|
||||
Following these steps to prepare stb:
|
||||
|
||||
1. Clone stb repository first.
|
||||
1. Switch to a **specific commit hash** `2e2bef463a5b53ddf8bb788e25da6b8506314c08`. I do not frequently update this dependency so using the latest commit is inviable.
|
||||
|
||||
> [!NOTE]
|
||||
> std is a header-only C project. So we don't need compile it. libcmo21 will use homemade CMake script to find it.
|
||||
|
||||
### zlib
|
||||
|
||||
@@ -37,47 +45,109 @@ If you are in Windows, you should download zlib source code and build it with gi
|
||||
|
||||
If you are running on non-Windows system. You usually do not need to do anything. Because zlib development environment may be configured by your package manager correctly.
|
||||
|
||||
## Compile
|
||||
If you are in Windows, or in Linux but want to use specific zlib version due to various reasons, following these steps to prepare zlib:
|
||||
|
||||
### Directory Hierarchy
|
||||
1. Download zlib source code from its official.
|
||||
1. Extract it into a directory.
|
||||
1. Enter this directory and create 2 subdirectory `build` and `install` for CMake build and install respectively.
|
||||
1. Enter `build` directory and configure CMake with extra `-DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=<path-to-install>` parameters. And `<path-to-install>` is the absolute path to your created `install` directory in previous step (Idk why `--prefix` argument is not works for zlib).
|
||||
1. Use CMake to build zlib
|
||||
1. Use CMake to install zlib into previous we created `install` directory.
|
||||
|
||||
First, create subdirectory `Bin/build` and `Bin/install` at the root directory of libcmo21.
|
||||
> [!NOTE]
|
||||
> We use CMake, rather than any other to compile zlib because zlib provide it, and we also use CMake as our build system, so that we do not need to write any extra files for adaption.
|
||||
|
||||
### Configuration
|
||||
> [!CAUTION]
|
||||
> Windows developer should highly notice that please do NOT use Visual Studio file located in `contrib/vstudio` directory to produce binary zlib on Windows. That project will produce `zlibwapi.dll` which is not our expected `zlib.dll`. Please use Visual Studio embedded CMake to configure zlib and compile it directly.
|
||||
|
||||
Then enter subdirectory `Bin/build` and use following command to configure CMake:
|
||||
### Doxygen
|
||||
|
||||
- Windows (MSVC): `cmake -DNEMO_BUILD_UNVIRT=ON -DNEMO_BUILD_BMAP=ON -DNEMO_BUILD_DOC=OFF -DSTB_IMAGE_PATH=<path-to-stb> -DYYCC_PATH=<path-to-yycc-install> -DZLIB_HEADER_PATH=<path-to-zlib-hdr> -DZLIB_BINARY_PATH=<path-to-zlib-bin> ../..`
|
||||
- non-Windows: `cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DNEMO_BUILD_UNVIRT=ON -DNEMO_BUILD_BMAP=ON -DNEMO_BUILD_DOC=OFF -DSTB_IMAGE_PATH=<path-to-stb> -DYYCC_PATH=<path-to-yycc-install> ../..`
|
||||
Doxygen is required only if you need to build documentation.
|
||||
If you don't need this please skip this chapter.
|
||||
|
||||
The arguments in command should be replaced by:
|
||||
We use Doxygen 1.9.7.
|
||||
It would be okey use other versions but I have not test on them.
|
||||
|
||||
* `<path-to-stb>`: The root directory of your cloned stb repository.
|
||||
* `<path-to-yycc-install>`: The directory to installed CMake package you chosen when building YYCCommonplace.
|
||||
* `<path-to-zlib-hdr>` (Windows only): The root directory of downloaded zlib source code.
|
||||
* `<path-to-zlib-bin>` (Windows only): The directory where you can find built `zlibwapi.dll`.
|
||||
YYCCommonplace use Doxygen as its documentation system.
|
||||
So before compiling, you must make sure `doxygen` are presented in your environment.
|
||||
|
||||
The switches in command can be switched as you wish:
|
||||
## Build and Install
|
||||
|
||||
* `NEMO_BUILD_UNVIRT`: Build `Unvirt`, a command line application debugging Virtools files.
|
||||
* `NEMO_BUILD_BMAP`: Build `BMap`, a dynamic library specific used for loading Ballance map file. If you are coming from my another project [BallanceBlenderPlugin](https://github.com/yyc12345/BallanceBlenderHelper), this is what you need.
|
||||
* `NEMO_BUILD_DOC`: Build the document of libcmo21.
|
||||
There are 2 different ways to build this project.
|
||||
If you are the user of this project (just want this project to make something works), please choose "User Build".
|
||||
If you are a developer (developer of this project, or use this project as dependency to develop your project), please choose "Developer Build".
|
||||
|
||||
### Build
|
||||
### User Build
|
||||
|
||||
Execute following command to build libcmo21.
|
||||
"User Build" is basically how GitHub Action build this project.
|
||||
|
||||
* Windows: `cmake --build . --config RelWithDebInfo`
|
||||
* non-Windows: `cmake --build .`
|
||||
Under **the root directory** of this project, execute:
|
||||
|
||||
### Build Type
|
||||
- `Script/windows_build.bat` on Windows
|
||||
- or `Script/linux_build.sh` on Linux
|
||||
- or `Script/macos_build.sh` on macOS
|
||||
|
||||
Like YYCCommonplace, we suggest `RelWithDebInfo` for end user. If you want to build for programmer debugging, please replace all `RelWithDebInfo` to `Debug`. The build type between YYCCommonplace and libcmo21 should keep same to reduce any possibility about ABI incompatible issue.
|
||||
The final built artifact is under `Bin/install` directory.
|
||||
|
||||
## Install
|
||||
### Developer Build
|
||||
|
||||
Currently the CMake install script still has some bugs and can not work as expected. So as the alternative, just go into build directory and find your final program please. It's pretty simple.
|
||||
#### Configurable Variables
|
||||
|
||||
## Note
|
||||
First, there is a list listing all variables you may configure during compiling.
|
||||
|
||||
You may face issue when compiling this program on Linux or macOS because I develop this project on Windows frequently. The compatibility with Linux will only be checked just before releasing. And I don't have any Apple device to check the compatibility with macOS. So, for Linux issue, please report it directly and I will try to fix. For macOS bug, PR is welcomed.
|
||||
* `NEMO_BUILD_UNVIRT`: Set it to `ON` to build `Unvirt`. `ON` in default.
|
||||
This is an interactive tool for loading, saving Virtools file.
|
||||
It is extremely useful for debugging this project.
|
||||
* `NEMO_BUILD_BMAP`: Set it to `ON` to build `BMap`. `OFF` in default.
|
||||
It is a dynamic library specific used for loading Ballance map file.
|
||||
If you are coming from my another project [BallanceBlenderPlugin](https://github.com/yyc12345/BallanceBlenderHelper), this is what you need.
|
||||
* `NEMO_BUILD_DOC`: Set it to `ON` to build documentation. `OFF` in default.
|
||||
It may be useful for the developer who firstly use this project in their own projects.
|
||||
Please note that generated documentation is different in different platforms.
|
||||
* `YYCCommonplace_ROOT`: Set to the install path of YYCCommonplace.
|
||||
* `stb_ROOT`: Set to the root directory of stb.
|
||||
* `ZLIB_ROOT`: Set to the install path of zlib.
|
||||
If you are using zlib which is not build by your own, you usually do not need specify this variable.
|
||||
|
||||
#### Configure CMake
|
||||
|
||||
When configure CMake, you may use different options on different platforms.
|
||||
Following list may help you.
|
||||
|
||||
- On Windows:
|
||||
* `-A Win32` or `-A x64` to specify architecture.
|
||||
- On Linux or other POSIX systems:
|
||||
* `-DCMAKE_BUILD_TYPE=Debug` or `-DCMAKE_BUILD_TYPE=Release` to specify build type.
|
||||
|
||||
Additionally, you can attach any variables introduced above with `-D` option during CMake configurations.
|
||||
|
||||
> [!NOTE]
|
||||
> Position independent code flag is automatically added if you enable `BMap` so you don't need manually specify it. You just need to make sure that all dependencies enable this.
|
||||
|
||||
#### Build with CMake
|
||||
|
||||
After configuration, you can use `cmake --build .` to build project,
|
||||
with additional options on different platforms.
|
||||
Following list may help you.
|
||||
|
||||
- On Windows:
|
||||
* `--config Debug` or `--config Release` to specify build type.
|
||||
- On Linux or other POSIX systems:
|
||||
* None
|
||||
|
||||
#### Install with CMake
|
||||
|
||||
After building, you can use `cmake --install . --prefix <path-to-prefix>`
|
||||
to install project into given path, with additional options on different platforms.
|
||||
Following list may help you.
|
||||
|
||||
- On Windows:
|
||||
* `--config Debug` or `--config Release` to specify build type.
|
||||
- On Linux or other POSIX systems:
|
||||
* None
|
||||
|
||||
## Compatibility Notes
|
||||
|
||||
You may face issue when compiling this program on Linux or macOS because I develop this project on Windows frequently.
|
||||
The compatibility with Linux and macOS will only be checked just before releasing.
|
||||
And, I don't have any Apple devices, so the compatibility with macOS is checked by GitHub Action.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Configure version file
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/../CMake/VTVersion.hpp.in
|
||||
${CMAKE_CURRENT_LIST_DIR}/VTVersion.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/LibCmo/VTVersion.hpp.in
|
||||
${CMAKE_CURRENT_LIST_DIR}/LibCmo/VTVersion.hpp
|
||||
@ONLY
|
||||
)
|
||||
|
||||
@@ -10,93 +10,93 @@ add_library(LibCmo STATIC "")
|
||||
# Setup static library sources
|
||||
target_sources(LibCmo
|
||||
PRIVATE
|
||||
# Assistant source files
|
||||
VTEncoding.cpp
|
||||
VTImage.cpp
|
||||
# NeMo Shared
|
||||
LibCmo/VTEncoding.cpp
|
||||
LibCmo/VTImage.cpp
|
||||
# CK2
|
||||
CK2/CKBitmapData.cpp
|
||||
CK2/CKContext.cpp
|
||||
CK2/CKFileOthers.cpp
|
||||
CK2/CKFileReader.cpp
|
||||
CK2/CKFileWriter.cpp
|
||||
CK2/CKGlobals.cpp
|
||||
CK2/CKStateChunkOthers.cpp
|
||||
CK2/CKStateChunkReader.cpp
|
||||
CK2/CKStateChunkWriter.cpp
|
||||
LibCmo/CK2/CKBitmapData.cpp
|
||||
LibCmo/CK2/CKContext.cpp
|
||||
LibCmo/CK2/CKFileOthers.cpp
|
||||
LibCmo/CK2/CKFileReader.cpp
|
||||
LibCmo/CK2/CKFileWriter.cpp
|
||||
LibCmo/CK2/CKGlobals.cpp
|
||||
LibCmo/CK2/CKStateChunkOthers.cpp
|
||||
LibCmo/CK2/CKStateChunkReader.cpp
|
||||
LibCmo/CK2/CKStateChunkWriter.cpp
|
||||
# CK2 Data Handler
|
||||
CK2/DataHandlers/CKBitmapHandler.cpp
|
||||
LibCmo/CK2/DataHandlers/CKBitmapHandler.cpp
|
||||
# CK2 Manager
|
||||
CK2/MgrImpls/CKBaseManager.cpp
|
||||
CK2/MgrImpls/CKObjectManager.cpp
|
||||
CK2/MgrImpls/CKPathManager.cpp
|
||||
LibCmo/CK2/MgrImpls/CKBaseManager.cpp
|
||||
LibCmo/CK2/MgrImpls/CKObjectManager.cpp
|
||||
LibCmo/CK2/MgrImpls/CKPathManager.cpp
|
||||
# CK2 Object
|
||||
CK2/ObjImpls/CK3dEntity.cpp
|
||||
CK2/ObjImpls/CKBeObject.cpp
|
||||
CK2/ObjImpls/CKGroup.cpp
|
||||
CK2/ObjImpls/CKMaterial.cpp
|
||||
CK2/ObjImpls/CKMesh.cpp
|
||||
CK2/ObjImpls/CKObject.cpp
|
||||
CK2/ObjImpls/CKTexture.cpp
|
||||
CK2/ObjImpls/CKLight.cpp
|
||||
CK2/ObjImpls/CKTargetLight.cpp
|
||||
CK2/ObjImpls/CKCamera.cpp
|
||||
CK2/ObjImpls/CKTargetCamera.cpp
|
||||
LibCmo/CK2/ObjImpls/CK3dEntity.cpp
|
||||
LibCmo/CK2/ObjImpls/CKBeObject.cpp
|
||||
LibCmo/CK2/ObjImpls/CKGroup.cpp
|
||||
LibCmo/CK2/ObjImpls/CKMaterial.cpp
|
||||
LibCmo/CK2/ObjImpls/CKMesh.cpp
|
||||
LibCmo/CK2/ObjImpls/CKObject.cpp
|
||||
LibCmo/CK2/ObjImpls/CKTexture.cpp
|
||||
LibCmo/CK2/ObjImpls/CKLight.cpp
|
||||
LibCmo/CK2/ObjImpls/CKTargetLight.cpp
|
||||
LibCmo/CK2/ObjImpls/CKCamera.cpp
|
||||
LibCmo/CK2/ObjImpls/CKTargetCamera.cpp
|
||||
# VxMath
|
||||
VxMath/VxMemoryMappedFile.cpp
|
||||
VxMath/VxTypes.cpp
|
||||
VxMath/VxMath.cpp
|
||||
LibCmo/VxMath/VxMemoryMappedFile.cpp
|
||||
LibCmo/VxMath/VxTypes.cpp
|
||||
LibCmo/VxMath/VxMath.cpp
|
||||
# X Container
|
||||
XContainer/XTypes.cpp
|
||||
LibCmo/XContainer/XTypes.cpp
|
||||
)
|
||||
# Setup static library headers
|
||||
target_sources(LibCmo
|
||||
PUBLIC
|
||||
FILE_SET HEADERS
|
||||
FILES
|
||||
# Asststant header files
|
||||
VTVersion.hpp
|
||||
VTInternal.hpp
|
||||
VTEncoding.hpp
|
||||
VTUtils.hpp
|
||||
# NeMo Shared
|
||||
VTAll.hpp
|
||||
LibCmo/VTVersion.hpp
|
||||
LibCmo/VTInternal.hpp
|
||||
LibCmo/VTEncoding.hpp
|
||||
LibCmo/VTUtils.hpp
|
||||
# CK2
|
||||
CK2/CKDefines.hpp
|
||||
CK2/CKEnums.hpp
|
||||
CK2/CKGlobals.hpp
|
||||
CK2/CKIdentifiers.hpp
|
||||
CK2/CKTypes.hpp
|
||||
CK2/CKBitmapData.hpp
|
||||
CK2/CKContext.hpp
|
||||
CK2/CKFile.hpp
|
||||
CK2/CKStateChunk.hpp
|
||||
LibCmo/CK2/CKDefines.hpp
|
||||
LibCmo/CK2/CKEnums.hpp
|
||||
LibCmo/CK2/CKGlobals.hpp
|
||||
LibCmo/CK2/CKIdentifiers.hpp
|
||||
LibCmo/CK2/CKTypes.hpp
|
||||
LibCmo/CK2/CKBitmapData.hpp
|
||||
LibCmo/CK2/CKContext.hpp
|
||||
LibCmo/CK2/CKFile.hpp
|
||||
LibCmo/CK2/CKStateChunk.hpp
|
||||
# CK2 Data Handler
|
||||
CK2/DataHandlers/CKBitmapHandler.hpp
|
||||
LibCmo/CK2/DataHandlers/CKBitmapHandler.hpp
|
||||
# CK2 Manager
|
||||
CK2/MgrImpls/CKBaseManager.hpp
|
||||
CK2/MgrImpls/CKObjectManager.hpp
|
||||
CK2/MgrImpls/CKPathManager.hpp
|
||||
LibCmo/CK2/MgrImpls/CKBaseManager.hpp
|
||||
LibCmo/CK2/MgrImpls/CKObjectManager.hpp
|
||||
LibCmo/CK2/MgrImpls/CKPathManager.hpp
|
||||
# CK2 Object
|
||||
CK2/ObjImpls/CK3dEntity.hpp
|
||||
CK2/ObjImpls/CKBeObject.hpp
|
||||
CK2/ObjImpls/CKGroup.hpp
|
||||
CK2/ObjImpls/CKMaterial.hpp
|
||||
CK2/ObjImpls/CKMesh.hpp
|
||||
CK2/ObjImpls/CKObject.hpp
|
||||
CK2/ObjImpls/CKTexture.hpp
|
||||
CK2/ObjImpls/CK3dObject.hpp
|
||||
CK2/ObjImpls/CKRenderObject.hpp
|
||||
CK2/ObjImpls/CKSceneObject.hpp
|
||||
CK2/ObjImpls/CKLight.hpp
|
||||
CK2/ObjImpls/CKTargetLight.hpp
|
||||
CK2/ObjImpls/CKCamera.hpp
|
||||
CK2/ObjImpls/CKTargetCamera.hpp
|
||||
LibCmo/CK2/ObjImpls/CK3dEntity.hpp
|
||||
LibCmo/CK2/ObjImpls/CKBeObject.hpp
|
||||
LibCmo/CK2/ObjImpls/CKGroup.hpp
|
||||
LibCmo/CK2/ObjImpls/CKMaterial.hpp
|
||||
LibCmo/CK2/ObjImpls/CKMesh.hpp
|
||||
LibCmo/CK2/ObjImpls/CKObject.hpp
|
||||
LibCmo/CK2/ObjImpls/CKTexture.hpp
|
||||
LibCmo/CK2/ObjImpls/CK3dObject.hpp
|
||||
LibCmo/CK2/ObjImpls/CKRenderObject.hpp
|
||||
LibCmo/CK2/ObjImpls/CKSceneObject.hpp
|
||||
LibCmo/CK2/ObjImpls/CKLight.hpp
|
||||
LibCmo/CK2/ObjImpls/CKTargetLight.hpp
|
||||
LibCmo/CK2/ObjImpls/CKCamera.hpp
|
||||
LibCmo/CK2/ObjImpls/CKTargetCamera.hpp
|
||||
# VxMath
|
||||
VxMath/VxTypes.hpp
|
||||
VxMath/VxMath.hpp
|
||||
VxMath/VxEnums.hpp
|
||||
VxMath/VxMemoryMappedFile.hpp
|
||||
LibCmo/VxMath/VxTypes.hpp
|
||||
LibCmo/VxMath/VxMath.hpp
|
||||
LibCmo/VxMath/VxEnums.hpp
|
||||
LibCmo/VxMath/VxMemoryMappedFile.hpp
|
||||
# X Container
|
||||
XContainer/XTypes.hpp
|
||||
LibCmo/XContainer/XTypes.hpp
|
||||
)
|
||||
# Setup include and linked library infomation
|
||||
target_include_directories(LibCmo
|
||||
@@ -109,32 +109,13 @@ PUBLIC
|
||||
YYCC::YYCCommonplace
|
||||
PRIVATE
|
||||
ZLIB::ZLIB
|
||||
stb::stb-image
|
||||
)
|
||||
if (NOT WIN32)
|
||||
target_link_libraries(LibCmo PRIVATE Iconv::Iconv)
|
||||
endif ()
|
||||
# Setup C++ standard
|
||||
set_target_properties(LibCmo
|
||||
PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
CXX_STANDARD_REQUIRED 20
|
||||
CXX_EXTENSION OFF
|
||||
STB::STB
|
||||
)
|
||||
target_compile_definitions(LibCmo
|
||||
# Expose LibCmo build type
|
||||
PUBLIC
|
||||
"$<$<CONFIG:Debug>:LIBCMO_BUILD_DEBUG>"
|
||||
"$<$<CONFIG:Release,RelWithDebInfo,MinSize>:LIBCMO_BUILD_RELEASE>"
|
||||
# Unicode charset for private using
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:UNICODE>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:_UNICODE>
|
||||
)
|
||||
target_compile_options(LibCmo
|
||||
# Order build as UTF-8 in MSVC
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
||||
)
|
||||
|
||||
# Install binary and headers
|
||||
|
||||
@@ -13,33 +13,33 @@
|
||||
*/
|
||||
|
||||
// Include internal header
|
||||
#include "VTInternal.hpp"
|
||||
#include "LibCmo/VTInternal.hpp"
|
||||
|
||||
// CK2 Misc
|
||||
#include "CK2/CKContext.hpp"
|
||||
#include "CK2/CKStateChunk.hpp"
|
||||
#include "CK2/CKFile.hpp"
|
||||
#include "LibCmo/CK2/CKContext.hpp"
|
||||
#include "LibCmo/CK2/CKStateChunk.hpp"
|
||||
#include "LibCmo/CK2/CKFile.hpp"
|
||||
|
||||
// CK2 Data handlers
|
||||
#include "CK2/DataHandlers/CKBitmapHandler.hpp"
|
||||
#include "LibCmo/CK2/DataHandlers/CKBitmapHandler.hpp"
|
||||
|
||||
// CK2 Objects
|
||||
#include "CK2/ObjImpls/CKObject.hpp"
|
||||
#include "CK2/ObjImpls/CKSceneObject.hpp"
|
||||
#include "CK2/ObjImpls/CKBeObject.hpp"
|
||||
#include "CK2/ObjImpls/CKGroup.hpp"
|
||||
#include "CK2/ObjImpls/CKRenderObject.hpp"
|
||||
#include "CK2/ObjImpls/CK3dEntity.hpp"
|
||||
#include "CK2/ObjImpls/CK3dObject.hpp"
|
||||
#include "CK2/ObjImpls/CKTexture.hpp"
|
||||
#include "CK2/ObjImpls/CKMaterial.hpp"
|
||||
#include "CK2/ObjImpls/CKMesh.hpp"
|
||||
#include "CK2/ObjImpls/CKLight.hpp"
|
||||
#include "CK2/ObjImpls/CKTargetLight.hpp"
|
||||
#include "CK2/ObjImpls/CKCamera.hpp"
|
||||
#include "CK2/ObjImpls/CKTargetCamera.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKObject.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKSceneObject.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKBeObject.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKGroup.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKRenderObject.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CK3dEntity.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CK3dObject.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKTexture.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKMaterial.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKMesh.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKLight.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKTargetLight.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKCamera.hpp"
|
||||
#include "LibCmo/CK2/ObjImpls/CKTargetCamera.hpp"
|
||||
|
||||
// CK2 Managers
|
||||
#include "CK2/MgrImpls/CKBaseManager.hpp"
|
||||
#include "CK2/MgrImpls/CKObjectManager.hpp"
|
||||
#include "CK2/MgrImpls/CKPathManager.hpp"
|
||||
#include "LibCmo/CK2/MgrImpls/CKBaseManager.hpp"
|
||||
#include "LibCmo/CK2/MgrImpls/CKObjectManager.hpp"
|
||||
#include "LibCmo/CK2/MgrImpls/CKPathManager.hpp"
|
||||
|
||||
@@ -30,27 +30,8 @@ PRIVATE
|
||||
YYCC::YYCCommonplace
|
||||
LibCmo
|
||||
)
|
||||
# Setup C++ standard
|
||||
set_target_properties(Unvirt
|
||||
PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
CXX_STANDARD_REQUIRED 20
|
||||
CXX_EXTENSION OFF
|
||||
)
|
||||
# Order Unicode charset for private using
|
||||
target_compile_definitions(Unvirt
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:UNICODE>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:_UNICODE>
|
||||
)
|
||||
# Order build as UTF-8 in MSVC
|
||||
target_compile_options(Unvirt
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
||||
)
|
||||
|
||||
# Install Unvirt only on Release mode
|
||||
# Install Unvirt
|
||||
install(TARGETS Unvirt
|
||||
CONFIGURATIONS Release RelWithDebInfo MinSizeRel
|
||||
RUNTIME DESTINATION ${YYCC_INSTALL_BIN_PATH}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user