Skip to content

Commit

Permalink
fix: presets & code on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
f0e committed Nov 4, 2024
1 parent 62c40f5 commit 319e138
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 158 deletions.
79 changes: 33 additions & 46 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
cmake_minimum_required(VERSION 3.20)

if(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
elseif(APPLE)
set(VCPKG_TARGET_TRIPLET "x64-osx" CACHE STRING "")
elseif(UNIX)
set(VCPKG_TARGET_TRIPLET "x64-linux" CACHE STRING "")
endif()
set(VCPKG_LIBRARY_LINKAGE static)

# Force static runtime on Windows
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
Expand Down Expand Up @@ -67,46 +61,39 @@ function(setup_target target)
)
endfunction()

option(BUILD_CLI "Build CLI application" ON)
option(BUILD_GUI "Build GUI application" ON)

# cli
if (BUILD_CLI)
add_executable(blur-cli
${COMMON_SOURCES}
${CLI_SOURCES}
${RESOURCES}
src/cli/cli_pch.cpp
)
target_precompile_headers(blur-cli PRIVATE src/cli/cli_pch.h)
setup_target(blur-cli)
endif()
add_executable(blur-cli
${COMMON_SOURCES}
${CLI_SOURCES}
${RESOURCES}
src/cli/cli_pch.cpp
)
target_precompile_headers(blur-cli PRIVATE src/cli/cli_pch.h)
setup_target(blur-cli)

# gui
if (BUILD_GUI)
set(LAF_BACKEND "skia")
set(SKIA_DIR ${PROJECT_SOURCE_DIR}/dependencies/skia)
set(SKIA_LIBRARY_DIR ${SKIA_DIR}/out/Release)

set(LAF_WITH_EXAMPLES OFF) # disable examples
set(LAF_WITH_TESTS OFF) # disable tests

add_subdirectory(dependencies/laf)
set(LAF_BACKEND "skia")
set(SKIA_DIR ${PROJECT_SOURCE_DIR}/dependencies/skia)
set(SKIA_LIBRARY_DIR ${SKIA_DIR}/out/Release-arm64)

add_executable(blur-gui WIN32
${COMMON_SOURCES}
${GUI_SOURCES}
${RESOURCES}
src/gui/gui_pch.cpp
)
target_link_libraries(blur-gui PRIVATE
laf-base
laf-gfx
laf-os
ZLIB::ZLIB
)
target_precompile_headers(blur-gui PRIVATE src/gui/gui_pch.h)
set_target_properties(blur-gui PROPERTIES LINK_FLAGS "${LAF_BACKEND_LINK_FLAGS}")
set_target_properties(blur-gui PROPERTIES OUTPUT_NAME "blur")
setup_target(blur-gui)
endif()
set(LAF_WITH_EXAMPLES OFF) # disable examples
set(LAF_WITH_TESTS OFF) # disable tests

add_subdirectory(dependencies/laf)

add_executable(blur-gui WIN32
${COMMON_SOURCES}
${GUI_SOURCES}
${RESOURCES}
src/gui/gui_pch.cpp
)
target_link_libraries(blur-gui PRIVATE
laf-base
laf-gfx
laf-os
ZLIB::ZLIB
)
target_precompile_headers(blur-gui PRIVATE src/gui/gui_pch.h)
set_target_properties(blur-gui PROPERTIES LINK_FLAGS "${LAF_BACKEND_LINK_FLAGS}")
set_target_properties(blur-gui PROPERTIES OUTPUT_NAME "blur")
setup_target(blur-gui)
242 changes: 132 additions & 110 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,113 +1,135 @@
{
"version": 6,
"configurePresets": [
{
"name": "base",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "windows-base",
"inherits": "base",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Ninja",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-msvc-x64"
}
}
},
{
"name": "unix-base",
"inherits": "base",
"hidden": true,
"condition": {
"type": "notEquals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Ninja"
},
{
"name": "debug",
"inherits": [
"windows-base",
"unix-base"
],
"displayName": "Debug Build",
"binaryDir": "${sourceDir}/build/debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_MSVC_RUNTIME_LIBRARY": {
"type": "STRING",
"value": "MultiThreadedDebugDLL"
}
}
},
{
"name": "release",
"inherits": [
"windows-base",
"unix-base"
],
"displayName": "Release Build",
"binaryDir": "${sourceDir}/build/release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_MSVC_RUNTIME_LIBRARY": {
"type": "STRING",
"value": "MultiThreadedDLL"
}
}
},
{
"name": "relwithdebinfo",
"inherits": [
"windows-base",
"unix-base"
],
"displayName": "Release with Debug Info",
"binaryDir": "${sourceDir}/build/relwithdebinfo",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_MSVC_RUNTIME_LIBRARY": {
"type": "STRING",
"value": "MultiThreadedDLL"
}
}
"version": 6,
"configurePresets": [
{
"name": "base",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "win-base",
"inherits": "base",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Ninja",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-msvc-x64"
}
],
"buildPresets": [
{
"name": "debug",
"configurePreset": "debug",
"jobs": 0
},
{
"name": "release",
"configurePreset": "release",
"jobs": 0
},
{
"name": "relwithdebinfo",
"configurePreset": "relwithdebinfo",
"jobs": 0
}
},
{
"name": "unix-base",
"inherits": "base",
"hidden": true,
"condition": {
"type": "notEquals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_MSVC_RUNTIME_LIBRARY": {
"type": "STRING",
"value": "MultiThreadedDLL"
}
]
}
},
"generator": "Ninja"
},
{
"name": "win-debug",
"inherits": "win-base",
"displayName": "Debug Build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "win-release",
"inherits": "win-base",
"displayName": "Release Build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "win-relwithdebinfo",
"inherits": "win-base",
"displayName": "Release with Debug Info",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "unix-debug",
"inherits": "unix-base",
"displayName": "Debug Build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "unix-release",
"inherits": "unix-base",
"displayName": "Release Build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "unix-relwithdebinfo",
"inherits": "unix-base",
"displayName": "Release with Debug Info",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
}
],
"buildPresets": [
{
"name": "win-debug",
"configurePreset": "win-debug",
"jobs": 0
},
{
"name": "win-release",
"configurePreset": "win-release",
"jobs": 0
},
{
"name": "win-relwithdebinfo",
"configurePreset": "win-relwithdebinfo",
"jobs": 0
},
{
"name": "unix-debug",
"configurePreset": "unix-debug",
"jobs": 0
},
{
"name": "unix-release",
"configurePreset": "unix-release",
"jobs": 0
},
{
"name": "unix-relwithdebinfo",
"configurePreset": "unix-relwithdebinfo",
"jobs": 0
}
]
}
6 changes: 4 additions & 2 deletions src/common/rendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ bool c_render::do_render(s_render_commands render_commands) {
bp::args(render_commands.vspipe),
bp::std_out > vspipe_stdout,
bp::std_err > vspipe_stderr,
io_context,
io_context
#ifdef _WIN32
,
bp::windows::create_no_window
#endif
);
Expand All @@ -266,8 +267,9 @@ bool c_render::do_render(s_render_commands render_commands) {
bp::std_in < vspipe_stdout,
bp::std_out.null(),
bp::std_err.null(),
io_context,
io_context
#ifdef _WIN32
,
bp::windows::create_no_window
#endif
);
Expand Down

0 comments on commit 319e138

Please sign in to comment.