Skip to content

Commit

Permalink
Cmake Cleanups continue
Browse files Browse the repository at this point in the history
- Fix headless
- Make "Release" the default
- Kill the pointless ScalablePiggy complexity which we really don't
  need now we have skins coming

Addresses surge-synthesizer#1206
  • Loading branch information
baconpaul committed Apr 14, 2020
1 parent 3546a20 commit c69bd6d
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 102 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ surge-*.make
premake-stamp
cmake-stamp
/Debug
src/linux/ScalablePiggy*
*.deb

# Qt Creator
Expand Down
120 changes: 19 additions & 101 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Surge CMake file
# Exports targets for each of our builds
#
# Current Status - this builds the following assets
# Current Status - this builds the whole shooting match
# See issue 1206 for our working list to get this finished
#
# Win32 headless
# Win64 headless
# MacOSX headless
# Linux headless

cmake_minimum_required(VERSION 3.10)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Build for 10.12")

project(Surge VERSION 1.7.0 LANGUAGES CXX ASM)

#set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)

# Set up external packages
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
Expand Down Expand Up @@ -287,15 +284,15 @@ if( APPLE )
elseif( UNIX AND NOT APPLE )
set(SURGE_OS_SOURCES
src/linux/UserInteractionsLinux.cpp
src/linux/ConfigurationXml.S
src/linux/ScalablePiggy.S
)

file(GLOB LINUX_VSTGUI_GLOB vstgui.surge/vstgui/lib/platform/linux/*.cpp )

set(SURGE_OS_GUI_SOURCES
src/linux/DisplayInfoLinux.cpp
src/linux/RuntimeFontLinux.cpp
src/linux/ConfigurationXml.S
src/linux/ScalablePiggy.S
vstgui.surge/vstgui/vstgui.cpp
vstgui.surge/vstgui/vstgui_uidescription.cpp
vstgui.surge/vstgui/lib/platform/common/genericoptionmenu.cpp
Expand Down Expand Up @@ -350,14 +347,6 @@ elseif( UNIX AND NOT APPLE )
${XKBX11COMMON_LDFLAGS}
)

add_custom_target( generate-svg-embed ALL )
add_custom_command(
TARGET generate-svg-embed
PRE_BUILD
COMMAND echo "Updating SVG Assets"
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/linux/emit-vector-piggy.py ${CMAKE_CURRENT_SOURCE_DIR}
)

elseif( WIN32 )

set(SURGE_OS_SOURCES
Expand Down Expand Up @@ -494,7 +483,6 @@ if( BUILD_VST3 )
target_compile_features(surge-vst3 PRIVATE cxx_std_17 )

if( UNIX AND NOT APPLE )
add_dependencies(surge-vst3 generate-svg-embed)
target_sources(surge-vst3 PUBLIC
vst3sdk/public.sdk/source/main/linuxmain.cpp
src/linux/LinuxVST3Helpers.cpp)
Expand Down Expand Up @@ -578,7 +566,6 @@ if( BUILD_VST2 )
)

if( UNIX AND NOT APPLE )
add_dependencies(surge-vst2 generate-svg-embed)
target_sources(surge-vst2 PUBLIC src/linux/linux-aeffguieditor.cpp )

# Ideally we wouldn't define __cdecl on linux. It's not needed
Expand Down Expand Up @@ -659,10 +646,6 @@ if( BUILD_LV2 )
)

target_compile_features(surge-lv2 PRIVATE cxx_std_17 )

if( UNIX AND NOT APPLE )
add_dependencies(surge-lv2 generate-svg-embed)
endif()

target_compile_definitions(surge-lv2
PRIVATE
Expand Down Expand Up @@ -725,6 +708,7 @@ if( BUILD_HEADLESS )

target_compile_definitions(surge-headless
PRIVATE
${OS_COMPILE_DEFINITIONS}
TARGET_HEADLESS=1
LIBMIDIFILE=1
)
Expand All @@ -733,6 +717,7 @@ if( BUILD_HEADLESS )
PRIVATE
${SURGE_COMMON_INCLUDES}
${LIB_MIDIFILE_INCLUDES}
${OS_INCLUDE_DIRECTORIES}
src/headless
)

Expand All @@ -745,95 +730,28 @@ if( BUILD_HEADLESS )
PRIVATE
LIBSNDFILE=1
)
target_link_libraries(surge-headless ${LIBSNDFILE_LIBRARIES})
target_link_libraries(surge-headless PRIVATE ${LIBSNDFILE_LIBRARIES})
include_directories(surge-headless ${LIBSNDFILE_INCLUDE_DIRS})
endif()

# *NIX
if (UNIX)
target_compile_options(surge-headless
PRIVATE
-msse2
"-D_aligned_malloc(x,a)=malloc(x)"
"-D_aligned_free(x)=free(x)"
)
endif()

# macOS
if (APPLE)
target_compile_definitions(surge-headless
PRIVATE
MAC=1
MAC_COCOA=1
COCOA=1
OBJC_OLD_DISPATCH_PROTOTYPES=1
)
target_link_libraries(surge-headless
PRIVATE
${OS_LINK_LIBRARIES}
)

target_include_directories(surge-headless
PRIVATE
src/mac
)
target_compile_options(surge-headless
PRIVATE
${OS_COMPILE_OPTIONS}
)

target_link_libraries(surge-headless
"-framework ApplicationServices"
"-framework CoreFoundation"
)
endif()

# Linux
if (UNIX AND NOT APPLE)
if( UNIX AND NOT APPLE )
find_package(Threads REQUIRED)

add_custom_target(
scalable-piggy ALL
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/linux/_ScalablePiggy.S
)

add_custom_command(
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/src/linux/_ScalablePiggy.S
${CMAKE_CURRENT_SOURCE_DIR}/src/linux/ScalablePiggy.S

COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/linux/emit-vector-piggy.py ${CMAKE_CURRENT_SOURCE_DIR}
)

target_compile_definitions(surge-headless
PRIVATE
LINUX=1
)

target_sources(surge-headless
PRIVATE
src/linux/ConfigurationXml.S
src/linux/ScalablePiggy.S
)

target_include_directories(surge-headless
PRIVATE
src/linux
)

target_sources( surge-headless PUBLIC src/linux/ConfigurationXml.S )
target_link_libraries(surge-headless
PRIVATE
stdc++fs
Threads::Threads
)
endif()

if (WIN32)
target_compile_definitions(surge-headless
PRIVATE
WINDOWS=1
NOMINMAX=1
)

target_compile_options(surge-headless
PRIVATE
/arch:SSE2
"/FI precompiled.h"
/Zc:alignedNew
/bigobj
)

target_link_libraries(surge-headless winmm.lib)
endif()
endif()
49 changes: 49 additions & 0 deletions src/linux/ScalablePiggy.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT IT.
#
# If you need to modify this file, please read the comment
# in scripts/linux/emit-vector-piggy.py

.section ".rodata", "a"

memorySVGListStart:
.globl memorySVGListStart

.incbin "../../assets/original-vector/SVG/exported/bmp00160.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00134.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00132.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00137.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00163.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00113.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00105.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00145.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00164.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00102.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00122.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00136.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00146.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00123.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00140.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00124.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00125.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00112.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00158.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00118.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00148.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00157.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00161.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00143.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00121.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00154.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00119.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00152.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00153.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00108.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00120.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00114.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00144.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00149.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00126.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00159.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00117.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00151.svg"
.incbin "../../assets/original-vector/SVG/exported/bmp00162.svg"
57 changes: 57 additions & 0 deletions src/linux/ScalablePiggy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT IT.
**
** If you need to modify this file, please read the comment
** in scripts/linux/emit-vector-piggy.py
*/

struct MemorySVG {
const char *name;
unsigned long size;
unsigned long offset;
};

extern unsigned char memorySVGListStart[];

static const struct MemorySVG memorySVGList[] = {
{"svg/bmp00160.svg", 10678, 0},
{"svg/bmp00134.svg", 3756, 10678},
{"svg/bmp00132.svg", 6789, 14434},
{"svg/bmp00137.svg", 4747, 21223},
{"svg/bmp00163.svg", 70278, 25970},
{"svg/bmp00113.svg", 5641, 96248},
{"svg/bmp00105.svg", 17117, 101889},
{"svg/bmp00145.svg", 1693, 119006},
{"svg/bmp00164.svg", 4746, 120699},
{"svg/bmp00102.svg", 445763, 125445},
{"svg/bmp00122.svg", 18763, 571208},
{"svg/bmp00136.svg", 127401, 589971},
{"svg/bmp00146.svg", 106953, 717372},
{"svg/bmp00123.svg", 246164, 824325},
{"svg/bmp00140.svg", 1175, 1070489},
{"svg/bmp00124.svg", 1373, 1071664},
{"svg/bmp00125.svg", 14157, 1073037},
{"svg/bmp00112.svg", 175432, 1087194},
{"svg/bmp00158.svg", 6393, 1262626},
{"svg/bmp00118.svg", 99401, 1269019},
{"svg/bmp00148.svg", 8956, 1368420},
{"svg/bmp00157.svg", 8256, 1377376},
{"svg/bmp00161.svg", 73845, 1385632},
{"svg/bmp00143.svg", 1058, 1459477},
{"svg/bmp00121.svg", 5859, 1460535},
{"svg/bmp00154.svg", 31928, 1466394},
{"svg/bmp00119.svg", 51065, 1498322},
{"svg/bmp00152.svg", 20629, 1549387},
{"svg/bmp00153.svg", 4513, 1570016},
{"svg/bmp00108.svg", 36308, 1574529},
{"svg/bmp00120.svg", 162456, 1610837},
{"svg/bmp00114.svg", 94898, 1773293},
{"svg/bmp00144.svg", 93213, 1868191},
{"svg/bmp00149.svg", 1983, 1961404},
{"svg/bmp00126.svg", 17172, 1963387},
{"svg/bmp00159.svg", 5796, 1980559},
{"svg/bmp00117.svg", 99401, 1986355},
{"svg/bmp00151.svg", 85717, 2085756},
{"svg/bmp00162.svg", 21262, 2171473},
{NULL, 0}
};

0 comments on commit c69bd6d

Please sign in to comment.