forked from LMMS/lmms
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom CMakeLists.txt file and do more replacing in code
- Loading branch information
1 parent
a9a597e
commit 68de469
Showing
3 changed files
with
77 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,11 @@ | ||
INCLUDE(BuildPlugin) | ||
|
||
INCLUDE_DIRECTORIES(resid) | ||
include_directories(resid/resid) | ||
add_subdirectory(resid) | ||
|
||
BUILD_PLUGIN(sid | ||
SidInstrument.cpp | ||
SidInstrument.h | ||
resid/envelope.h | ||
resid/extfilt.h | ||
resid/filter.h | ||
resid/pot.h | ||
resid/siddefs.h | ||
resid/sid.h | ||
resid/spline.h | ||
resid/voice.h | ||
resid/wave.h | ||
resid/envelope.cc | ||
resid/extfilt.cc | ||
resid/filter.cc | ||
resid/pot.cc | ||
resid/sid.cc | ||
resid/version.cc | ||
resid/voice.cc | ||
resid/wave6581_PS_.cc | ||
resid/wave6581_PST.cc | ||
resid/wave6581_P_T.cc | ||
resid/wave6581__ST.cc | ||
resid/wave8580_PS_.cc | ||
resid/wave8580_PST.cc | ||
resid/wave8580_P_T.cc | ||
resid/wave8580__ST.cc | ||
resid/wave.cc | ||
$<TARGET_OBJECTS:resid> | ||
MOCFILES SidInstrument.h | ||
EMBEDDED_RESOURCES *.png) | ||
|
||
# Parse VERSION | ||
FILE(READ "resid/CMakeLists.txt" lines) | ||
STRING(REGEX MATCH "set\\(MAJOR_VER [A-Za-z0-9_]*\\)" MAJOR_RAW ${lines}) | ||
STRING(REGEX MATCH "set\\(MINOR_VER [A-Za-z0-9_]*\\)" MINOR_RAW ${lines}) | ||
STRING(REGEX MATCH "set\\(PATCH_VER [A-Za-z0-9_]*\\)" PATCH_RAW ${lines}) | ||
SEPARATE_ARGUMENTS(MAJOR_RAW) | ||
SEPARATE_ARGUMENTS(MINOR_RAW) | ||
SEPARATE_ARGUMENTS(PATCH_RAW) | ||
LIST(GET MAJOR_RAW 1 MAJOR_RAW) | ||
LIST(GET MINOR_RAW 1 MINOR_RAW) | ||
LIST(GET PATCH_RAW 1 PATCH_RAW) | ||
STRING(REPLACE ")" "" MAJOR_VER "${MAJOR_RAW}") | ||
STRING(REPLACE ")" "" MINOR_VER "${MINOR_RAW}") | ||
STRING(REPLACE ")" "" PATCH_VER "${PATCH_RAW}") | ||
|
||
TARGET_COMPILE_DEFINITIONS(sid PRIVATE VERSION="${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,67 @@ | ||
add_library(resid OBJECT | ||
resid/dac.cc | ||
resid/envelope.cc | ||
resid/extfilt.cc | ||
resid/filter8580new.cc | ||
resid/filter.cc | ||
resid/pot.cc | ||
add_library(resid OBJECT | ||
resid/sid.cc | ||
resid/voice.cc | ||
resid/wave.cc | ||
resid/envelope.cc | ||
resid/filter8580new.cc | ||
resid/dac.cc | ||
resid/extfilt.cc | ||
resid/pot.cc | ||
resid/version.cc | ||
) | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resid/siddefs.h.in ${CMAKE_CURRENT_SOURCE_DIR}/resid/siddefs.h @ONLY) | ||
target_include_directories(resid PUBLIC resid) | ||
target_include_directories(resid PUBLIC resid) | ||
|
||
set(RESID_WAVE_DATA | ||
wave6581_PST | ||
wave6581_PS_ | ||
wave6581_P_T | ||
wave6581__ST | ||
wave8580_PST | ||
wave8580_PS_ | ||
wave8580_P_T | ||
wave8580__ST | ||
) | ||
|
||
find_package(Perl) | ||
if(${PERL_FOUND}) | ||
set(RESID_SAMP2SRC_SCRIPT samp2src.pl) | ||
foreach(WAVE_DATA ${RESID_WAVE_DATA}) | ||
add_custom_command( | ||
OUTPUT | ||
${CMAKE_CURRENT_SOURCE_DIR}/resid/${WAVE_DATA}.h | ||
COMMAND | ||
${PERL_EXECUTABLE} | ||
${CMAKE_CURRENT_SOURCE_DIR}/resid/${RESID_SAMP2SRC_SCRIPT} | ||
${CMAKE_CURRENT_SOURCE_DIR}/resid/${WAVE_DATA} | ||
${CMAKE_CURRENT_SOURCE_DIR}/resid/${WAVE_DATA}.dat | ||
${CMAKE_CURRENT_SOURCE_DIR}/resid/${WAVE_DATA}.h | ||
VERBATIM | ||
COMMENT "Generating resid wave data" | ||
) | ||
target_sources(resid PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/resid/${WAVE_DATA}.h) | ||
endforeach() | ||
else() | ||
message(SEND_ERROR "Cannot build resid - Perl not found") | ||
endif() | ||
|
||
# These are the defaults | ||
set(RESID_INLINING 1) | ||
set(RESID_INLINE inline) | ||
set(RESID_BRANCH_HINTS 1) | ||
set(NEW_8580_FILTER 1) | ||
|
||
check_cxx_source_compiles("int main() { bool flag; }" HAVE_BOOL) | ||
check_cxx_source_compiles("int main() { __builtin_expect(0, 0); }" HAVE_BUILTIN_EXPECT) | ||
check_cxx_source_compiles("#include <math.h> int main() { log1p(1); }" HAVE_LOG1P) | ||
|
||
configure_file(resid/siddefs.h.in resid/siddefs.h @ONLY) | ||
configure_file(resid/siddefs.h.in ${CMAKE_CURRENT_SOURCE_DIR}/resid/siddefs.h @ONLY) | ||
|
||
# used the version from the previous submodule, this might not be accurate | ||
set(SRC_VER 0.16) | ||
set(MAJOR_VER 5) | ||
set(MINOR_VER 0) | ||
set(PATCH_VER 0) | ||
|
||
target_compile_definitions(resid PUBLIC VERSION="${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}") |