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

add cmake for Win and Linux #363

Merged
merged 157 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
62ea9ff
add cmake for Win and Linux
th-2021 Jun 23, 2022
31321bd
fix some compilation issues
May 16, 2022
e0c0c55
add libdl
May 16, 2022
a7b0b08
rename ZAPD to ZAPD.out for compatibility with OTRGui
th-2021 May 22, 2022
a131801
add utility functions
th-2021 Jun 4, 2022
69bf035
ad OTRGui
th-2021 Jun 4, 2022
e7b3639
fix for Linux
th-2021 Jun 4, 2022
a409457
fix embedded escaped space
th-2021 Jun 4, 2022
92080e2
fix dependencies; add language standard
th-2021 Jun 4, 2022
75bf1d4
correct dependencies; add floating options for Linux
th-2021 Jun 4, 2022
978b3ec
sync with main repo
th-2021 Jun 19, 2022
209844a
add CMakeLists.txt
th-2021 Jun 22, 2022
8c1651a
fix stormlib
th-2021 Jun 19, 2022
71873f2
fix stormlib
th-2021 Jun 19, 2022
ccb90c5
add SaveManager
th-2021 Jun 22, 2022
16dceb8
remove git clone StormLib
th-2021 Jun 23, 2022
28c05ef
enable Clang (first step)
th-2021 Jun 23, 2022
71eb54d
Fix cmake files for macos
th-2021 Aug 3, 2022
f5dd34a
fix Windows build
th-2021 Jun 26, 2022
48306ba
cleanup
th-2021 Jun 26, 2022
46a2ca7
cleanup
th-2021 Jun 27, 2022
9b1b383
fix typo
th-2021 Jun 27, 2022
c541009
add Linux to Fast3D extra
th-2021 Jun 28, 2022
12a396d
renamed some files
th-2021 Jun 28, 2022
ff89a32
more cleanup
th-2021 Jun 29, 2022
856cff5
add install target
th-2021 Jun 29, 2022
e5dd950
fix typos
th-2021 Jun 29, 2022
cdc8d4a
fix typos
th-2021 Jun 29, 2022
b40bfe6
fix spaces
th-2021 Jun 29, 2022
833cef4
remove Fortran
th-2021 Jun 29, 2022
9f69eb3
cleanup
th-2021 Jun 29, 2022
0ca5695
add top-level file
th-2021 Jun 29, 2022
371972f
add packaging
th-2021 Jun 29, 2022
e15633b
formatting
th-2021 Jun 29, 2022
6ce51c7
correct Windows lineage
th-2021 Jun 29, 2022
54f343a
add gamecontrollerdb.txt
th-2021 Jun 29, 2022
4237600
fixes for Windows 64 bit and packaging
th-2021 Jun 30, 2022
2bbea86
fix typo
th-2021 Jun 30, 2022
2c9f16c
no LICENSE
th-2021 Jun 30, 2022
a947761
remove Debug clause
th-2021 Jun 30, 2022
77c4ba8
fix win64 build
th-2021 Jul 6, 2022
ed80aa5
fix typo
th-2021 Jul 6, 2022
ee851e6
add include dir
th-2021 Jul 6, 2022
d1b1356
add CosmeticsEditor
th-2021 Jul 6, 2022
6183e73
update
th-2021 Jul 6, 2022
7c099ef
fix extract asses on Windows
th-2021 Jul 7, 2022
558b439
replace build-cmake with CMAKE_BINARY_DIR
th-2021 Jul 7, 2022
54fdec3
change Linux build to Ninja
th-2021 Jul 8, 2022
fbf50d3
glew update, appimage update
th-2021 Jul 11, 2022
cd12ad4
update BUILDING-cmake.md
th-2021 Jul 11, 2022
2fda3fc
fix win32 lib path
th-2021 Jul 11, 2022
07014bc
fix linuxdeploy in container; added CMAKE_SOURCE_DIR to glew
th-2021 Jul 11, 2022
d510ae4
update to 3.0.0
th-2021 Jul 16, 2022
5559ebb
updated Windows part
th-2021 Jul 22, 2022
d15563c
clarify classical build
th-2021 Jul 22, 2022
e0545ba
update to main; add MacOS
th-2021 Jul 22, 2022
c5fae24
fix typo
th-2021 Jul 22, 2022
413c667
Get macOS to compile
dcvz Jul 22, 2022
7f8f775
small fixes
th-2021 Jul 22, 2022
932d827
[macos] intermediate binary with arch name
dcvz Jul 23, 2022
c39b858
more packaging fixes
th-2021 Jul 23, 2022
3a49262
more packaging fixes
th-2021 Jul 23, 2022
ece42f9
more packaging fixes
th-2021 Jul 23, 2022
d0a2b1b
fixup_bundle only on MacOS
th-2021 Jul 23, 2022
76f8c82
small appimage fix
th-2021 Jul 23, 2022
45cc3e0
small appimage fix
th-2021 Jul 23, 2022
f6a35e4
Fix macos bundling and lib bundling
dcvz Jul 23, 2022
1af2a93
[macos] don’t include linux files
dcvz Jul 23, 2022
f41baad
use startup script for MacOS bundle
th-2021 Jul 23, 2022
921be85
fix packaging on MacOS
th-2021 Jul 23, 2022
e2fd092
adjust Windows zip
Jul 23, 2022
61f73b5
delete oot.otr before generating new
th-2021 Jul 23, 2022
c3a94da
integrate vcpkg build
th-2021 Jul 24, 2022
ea164d7
integrate vcpkg build
th-2021 Jul 24, 2022
18b714a
search python also at {env.PYTHON}
th-2021 Jul 25, 2022
0380388
need to check for Python3
th-2021 Jul 25, 2022
46eb4a0
Add distribution of LInux & macOS
th-2021 Aug 3, 2022
ce71896
Update Dockerfile
th-2021 Aug 3, 2022
0fc4bbe
Update Dockerfile
th-2021 Jul 24, 2022
bdf8b98
Update Dockerfile
th-2021 Jul 24, 2022
a9d8397
Update Dockerfile
th-2021 Jul 24, 2022
b72ee3d
Update Dockerfile
th-2021 Jul 24, 2022
a394e86
Update Dockerfile
th-2021 Jul 24, 2022
3d6be6b
Update Dockerfile
th-2021 Jul 24, 2022
aae221e
Update Dockerfile
th-2021 Jul 24, 2022
e8cf13c
Update Dockerfile
th-2021 Aug 3, 2022
545780e
Update Dockerfile
th-2021 Aug 3, 2022
959e05b
Update Jenkinsfile to cd into build folder
dcvz Jul 24, 2022
91160ce
Fix cpack command
dcvz Jul 24, 2022
c47b48f
Update the appimage scripts
th-2021 Aug 3, 2022
536ef68
Build windows cmake on Jenkins
dcvz Jul 24, 2022
5d5388e
set python path for Windows
dcvz Jul 24, 2022
65f8ec4
install python via vcpkg
dcvz Jul 24, 2022
acd5e67
Try to fix python path
dcvz Jul 24, 2022
2054ad5
Try new flag for windows python spec
dcvz Jul 24, 2022
c45a960
Remove installation of python3
dcvz Jul 24, 2022
a9d5030
windows: COPY rom file
dcvz Jul 24, 2022
9751835
Use ninja on macOS
dcvz Jul 24, 2022
896198d
rename scripts/linux to scripts/linux/appimage
th-2021 Jul 25, 2022
dce60c1
rename scripts/linux to scripts/linux/appimage
th-2021 Aug 3, 2022
64ca3eb
BULDING-cmake update
th-2021 Jul 26, 2022
858a855
correct path to linux build script
th-2021 Jul 26, 2022
e7a83d2
set VS startup project
th-2021 Jul 26, 2022
3deea36
create assets only once
th-2021 Jul 27, 2022
909e5b7
only copy assets for OTRGui
th-2021 Jul 27, 2022
394afd7
Fix macos artififact path
dcvz Jul 26, 2022
af389cf
Add verbosity for further logging
dcvz Jul 26, 2022
41fd1cd
Try changing output path
dcvz Aug 1, 2022
4090b6a
Fix path of appimge
dcvz Aug 1, 2022
55e57e5
pathconf for NintendoSwitch
th-2021 Aug 3, 2022
bd5e4be
add Nintendo Switch
th-2021 Aug 3, 2022
e9b74db
fix typo
th-2021 Aug 3, 2022
a272354
remove Environment
th-2021 Aug 3, 2022
453f6e0
remove color.h
th-2021 Aug 3, 2022
3029cb0
fix MATCHES
th-2021 Aug 3, 2022
1d431f7
comment out Intel sse2 option
th-2021 Aug 3, 2022
0922169
add switch support
th-2021 Aug 3, 2022
9ee88ff
ZAPD.out also on Darwin
th-2021 Aug 3, 2022
38ef459
use instead of cmake
th-2021 Aug 3, 2022
62a6d76
check for curl
th-2021 Aug 3, 2022
a70077d
conditionally add Intel CPU option SSE2
th-2021 Aug 3, 2022
2128926
Fix Dockerfile & Jenkins (#5)
dcvz Aug 3, 2022
243f8be
add -O3 -ffast-math for Nintendo Switch
th-2021 Aug 3, 2022
0ca1843
Build universally on macOS
dcvz Aug 3, 2022
79cc45a
use CMAKE_BUILD_TYPE
th-2021 Aug 3, 2022
5fdb2cd
Update building instructions
dcvz Aug 3, 2022
6057ad6
set default to Debug
th-2021 Aug 3, 2022
f0a99df
use_props only on Windows - for now
th-2021 Aug 3, 2022
ca96b05
Add ninja to macOS requirements
dcvz Aug 3, 2022
5e8168f
Remove Makefiles & VS solutions
dcvz Aug 3, 2022
85ddb4d
Update instructions to use multiple cores
dcvz Aug 4, 2022
e49fe05
Remove custom gcc mac toolchain
dcvz Aug 4, 2022
edcd39d
Use ninja to build directly
dcvz Aug 4, 2022
3d7521f
Update macos requirements
dcvz Aug 4, 2022
db57579
Add tip about VSC
dcvz Aug 4, 2022
fc66066
remove assets_created; copy oot.otr file
th-2021 Aug 4, 2022
ad4d58f
Revert "Use ninja to build directly"
dcvz Aug 4, 2022
92334c9
Rely on Ninja’s multithreadedness
dcvz Aug 4, 2022
e032974
Extra big warning about ninja tools
dcvz Aug 4, 2022
c0780c5
Add missing step for generating assets before building
dcvz Aug 4, 2022
0712398
Document clean command
dcvz Aug 4, 2022
6f678c6
replace Release with CMAKE_BUILD_TYPE in ExtractAssets
th-2021 Aug 4, 2022
655590e
Add release builds in Jenkins
dcvz Aug 4, 2022
08d54b2
Fix macOS release build issue
dcvz Aug 4, 2022
ed506fc
[windows] Extract assets before building
dcvz Aug 4, 2022
0d0b516
Update gitignore
dcvz Aug 4, 2022
ccb49de
Add more updates
dcvz Aug 4, 2022
60e0bd8
Add more details on developing SoH
dcvz Aug 4, 2022
3e75a07
Make navigating more clear for Windows
dcvz Aug 4, 2022
a2d1783
Try experimental multithreading
dcvz Aug 4, 2022
0ec3578
Fix build type
dcvz Aug 4, 2022
ab5771d
Merge branch 'develop-zhora' into feature/cmake
dcvz Aug 4, 2022
19a35ba
Fix merge issues
dcvz Aug 4, 2022
2d97834
Fix typo in BUILDING.md
dcvz Aug 4, 2022
708fd61
Delete stray macos toolchain file
dcvz Aug 4, 2022
f0d2cf0
Update windows note on using VSC
dcvz Aug 4, 2022
a65af79
Merge branch 'develop-zhora' into feature/cmake
dcvz Aug 5, 2022
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
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ docs/doxygen/
*.map
*.dump
out.txt
*.sln
*.vcxproj
*.vcxproj.user
*.vcxproj.filters

# Tool artifacts
tools/mipspro7.2_compiler/
Expand Down Expand Up @@ -423,3 +427,18 @@ xcuserdata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

# cmake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
*/extract_assets_cmake*
/build*
156 changes: 121 additions & 35 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,150 @@

## Windows

1. Requires [Python](https://www.python.org/downloads/) >= 3.6.
2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/)
3. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`.
4. Clone the Ship of Harkinian repository.
5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice.
6. Run `OTRExporter/OTRExporter.sln`.
7. Switch the solution to `Release x64`.
8. Build the solution.
9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`.
10. Run `soh/soh.sln`
11. Switch the solution to `Release x86` or `Release x64`.
12. Build the solution.
13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`.
14. Launch `soh.exe`.
1. Requires Visual Studio 2022 Community Edition && `python3, cmake, git` (can be installed via chocolatey or manually)
2. Clone the Ship of Harkinian repository
3. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice

_Note: Instructions assume using powershell_
```powershell
# Navigate to the Shipwright repo within powershell. ie: cd "C:\yourpath\Shipwright"
cd Shipwright

# Setup cmake project
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # --config Release (if you're packaging)
# Compile project
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 # --config Release (if you're packaging)

# Now you can run the executable in .\build\x64

# If you need to clean the project you can run
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target clean
```

### Developing SoH
With the cmake build system you have two options for working on the project:

#### Visual Studio
To develop using Visual Studio you only need to use cmake to generate the solution file:
```powershell
# Generates Ship.sln at the root directory
& 'C:\Program Files\CMake\bin\cmake' -S . -G "Visual Studio 17 2022" -T v142 -A x64
```

#### Visual Studio Code or another editor
To develop using Visual Studio Code or another editor you only need to open the repository in it.
To build you'll need to follow the instructions from the building section.

_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._

_Experimental: You can also use another build system entirely rathen than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._


### Generating the distributable
After compiling the project you can generate the distributable by running:
```powershell
# Go to build folder
cd "build/x64"
# Generate
& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP
```

## Linux
1. Requires `gcc, x11, curl, python3, sdl2, libpng, glew, ninja, cmake`

**Important: For maximum performance make sure you have ninja build tools installed!**

_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._

```bash
# Clone the repo
git clone https://github.com/HarbourMasters/Shipwright.git
cd Shipwright
# Copy the baserom to the OTRExporter folder
cp <path to your ROM> OTRExporter
# Build the docker image
sudo docker build . -t soh
# Run the docker image with the working directory mounted to /soh
sudo docker run --rm -it -v $(pwd):/soh soh /bin/bash
# Generate Ninja project
cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Compile the project
cmake --build build-cmake # --config Release (if you're packaging)

# Now you can run the executable in ./build-cmake/soh/soh.elf
# To develop the project open the repository in VSCode (or your preferred editor)

# If you need to clean the project you can run
cmake --build build-cmake --target clean
```
Inside the Docker container:

### Generating a distributable
After compiling the project you can generate a distributable by running of the following:
```bash
cd soh
# Extract the assets/Compile the exporter/Run the exporter
make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0
# Compile the code
make -j $(nproc) OPTFLAGS=-O2 DEBUG=0
# Go to build folder
cd build-cmake
# Generate
cpack -G DEB
cpack -G ZIP
cpack -G External (creates appimage)
```

## macOS
1. Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, ninja, cmake` (can be installed via homebrew, macports, etc)

**Important: For maximum performance make sure you have ninja build tools installed!**

_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._

1. Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, cmake, pkgconfig, dylibbundler` (can be installed via homebrew, macports, etc)
```bash
# Clone the repo
git clone https://github.com/HarbourMasters/Shipwright.git
cd ShipWright
# Copy the baserom to the OTRExporter folder
cp <path to your ROM> OTRExporter
# Generate Ninja project
cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Compile the project
cmake --build build-cmake # --config Release (if you're packaging)

# Now you can run the executable in ./build-cmake/soh/soh-macos
# To develop the project open the repository in VSCode (or your preferred editor)

# If you need to clean the project you can run
cmake --build build-cmake --target clean
```

### Generating a distributable
After compiling the project you can generate a distributable by running of the following:
```bash
# Go to build folder
cd build-cmake
# Generate
cpack
```

## Switch
1. Requires that your build machine is setup with the tools necessary for your platform above
2. Requires that you have the switch build tools installed
3. Clone the Ship of Harkinian repository
4. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice

```bash
cd Shipwright
# Setup cmake project for your host machine
cmake -H. -Bbuild-cmake -GNinja
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Setup cmake project for building for Switch
cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
# Build project and generate nro
cmake --build build-switch --target soh_nro

cd soh
# Extract the assets/Compile the exporter/Run the exporter
# -jX defines number of cores to use for compilation - lower or remove entirely if having issues
make setup -j8 DEBUG=0
# Compile the code (watch the -j parameter as above)
make -j8 DEBUG=0
# Create macOS app bundle
make appbundle
# Now you can run the executable in ./build-switch/soh/soh.nro
# To develop the project open the repository in VSCode (or your preferred editor)
```
9. Copy your OTR file to ~/Library/Application\ Support/com.shipofharkinian.soh
10. Launch soh app in the soh folder!

# Compatible Roms
```
Expand Down
65 changes: 65 additions & 0 deletions CMake/Default.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
################################################################################
# Command for variable_watch. This command issues error message, if a variable
# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens
# variable_watch(<variable> property_reader_guard)
################################################################################
function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK)
if("${PROPERTY_READER_GUARD_DISABLED}")
return()
endif()

if("${ACCESS}" STREQUAL "MODIFIED_ACCESS")
message(FATAL_ERROR
" Variable ${VARIABLE} is not supposed to be changed.\n"
" It is used only for reading target property ${VARIABLE}.\n"
" Use\n"
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}\" \"<value>\")\n"
" or\n"
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}_<CONFIG>\" \"<value>\")\n"
" instead.\n")
endif()
endfunction()

################################################################################
# Create variable <name> with generator expression that expands to value of
# target property <name>_<CONFIG>. If property is empty or not set then property
# <name> is used instead. Variable <name> has watcher property_reader_guard that
# doesn't allow to edit it.
# create_property_reader(<name>)
# Input:
# name - Name of watched property and output variable
################################################################################
function(create_property_reader NAME)
set(PROPERTY_READER_GUARD_DISABLED TRUE)
set(CONFIG_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}_$<UPPER_CASE:$<CONFIG>>>>")
set(IS_CONFIG_VALUE_EMPTY "$<STREQUAL:${CONFIG_VALUE},>")
set(GENERAL_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}>>")
set("${NAME}" "$<IF:${IS_CONFIG_VALUE_EMPTY},${GENERAL_VALUE},${CONFIG_VALUE}>" PARENT_SCOPE)
variable_watch("${NAME}" property_reader_guard)
endfunction()

################################################################################
# Set property $<name>_${PROPS_CONFIG_U} of ${PROPS_TARGET} to <value>
# set_config_specific_property(<name> <value>)
# Input:
# name - Prefix of property name
# value - New value
################################################################################
function(set_config_specific_property NAME VALUE)
set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}")
endfunction()

################################################################################

create_property_reader("TARGET_NAME")
create_property_reader("OUTPUT_DIRECTORY")

set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}")
set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}")

set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
12 changes: 12 additions & 0 deletions CMake/DefaultCXX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake")

set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$<NOT:$<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}")

if(MSVC)
create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING")
create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT")

set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc")
set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi")
endif()
30 changes: 30 additions & 0 deletions CMake/Packaging-2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_COMPONENTS_ALL "ship" "appimage")

if (NOT CPACK_GENERATOR STREQUAL "External")
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "appimage")
endif()

if (CPACK_GENERATOR MATCHES "DEB|RPM")
# https://unix.stackexchange.com/a/11552/254512
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/ship/bin")#/${CMAKE_PROJECT_VERSION}")
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0)
elseif (CPACK_GENERATOR MATCHES "ZIP")
set(CPACK_PACKAGING_INSTALL_PREFIX "")
endif()

if (CPACK_GENERATOR MATCHES "External")
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
SET(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/bin")
endif()

if (CPACK_GENERATOR MATCHES "Bundle")
set(CPACK_BUNDLE_NAME "soh")
set(CPACK_BUNDLE_PLIST "../soh/macosx/Info.plist")
set(CPACK_BUNDLE_ICON "macosx/soh.icns")
set(CPACK_BUNDLE_STARTUP_COMMAND "../soh/macosx/soh-macos.sh")
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
endif()

Loading