Skip to content

Commit

Permalink
fix cmake build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Jan 14, 2024
1 parent 3f79147 commit a94c094
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 33 deletions.
37 changes: 28 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ add_subdirectory($ENV{juce_DIR} subprojects/juce)
juce_add_gui_app(
LumatoneEditor
PRODUCT_NAME "Lumatone Editor"
# VERSION "1.2.0"
# BUNDLE_ID "com.Lumatone.LumatoneEditor"
VERSION "1.2.0"
BUNDLE_ID "com.Lumatone.LumatoneEditor"
# ICON_SMALL "${CMAKE_CURRENT_SOURCE_DIR}/BinaryData/Assets/PNG/[email protected]"
# ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/BinaryData/Assets/PNG/[email protected]"
# DOCUMENT_EXTENSIONS "ltn"
DOCUMENT_EXTENSIONS "ltn"
)
juce_generate_juce_header(LumatoneEditor)

Expand All @@ -31,13 +31,23 @@ file(GLOB_RECURSE SourceCode
)

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
file(GLOB_RECURSE LibraryCode CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/win64/include/*.h")
set(CryptoLib "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/win64/bin/libcrypto-1_1-x64.dll")
set(SSHLib "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/win64/bin/libssh2-x64.dll")
set(LibraryPath "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/win64")
set(LibraryInclude "${LibraryPath}/include")
set(LibraryCode "${LibraryInclude}/libssh2.h")
# set(CryptoLib "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/win64/bin/libcrypto-1_1-x64.dll")
# set(SSHLib "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/win64/bin/libssh2-x64.dll")

# add_library( CryptoLib SHARED IMPORTED )
# set_target_properties( CryptoLib PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/libcrypto-1_1-x64.dll" )

add_library( SSHLib SHARED IMPORTED )
set_target_properties( SSHLib PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/libssh2-x64.dll" )
set_target_properties( SSHLib PROPERTIES IMPORTED_IMPLIB "${LibraryPath}/lib/libssh2.dll.a" )
endif()

if (UNIX)
file(GLOB_RECURSE LibraryCode CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/mac/include/*.h")
set(LibraryInclude "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/mac/include")
set(LibraryCode "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/mac/include/libssh2.h")
file(READ
CryptoLib
"${CMAKE_CURRENT_SOURCE_DIR}/Libraries/mac/lib/libgpg-error.dylib"
Expand All @@ -46,6 +56,8 @@ if (UNIX)
file(READ SSHLib "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/mac/lib/libssh2.dylib")
endif()

include_directories(${LibraryInclude})

target_sources(
LumatoneEditor
PRIVATE
Expand Down Expand Up @@ -84,6 +96,13 @@ if (UNIX)
)
endif()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_compile_definitions(LumatoneEditor
PRIVATE
SERVERHOST="192.168.7.2"
)
endif()

file(GLOB_RECURSE LibraryBinaryData
CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/Source/lumatone_editor_library/assets/*"
Expand All @@ -106,8 +125,8 @@ target_link_libraries(LumatoneEditor
juce::juce_audio_devices
juce::juce_opengl

# ${CryptoLib}
# ${SSHLib}
# CryptoLib
SSHLib

PUBLIC
juce::juce_recommended_config_flags
Expand Down
48 changes: 24 additions & 24 deletions Source/ScaleStructureController/ScaleStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ Array<Point<int>> ScaleStructure::findDegreeMods(int degreeIndex, int chromaLeve
levels = jmin(chromaLevels, stepsToChromas.size());

String dbgstr = "";

// Change so that non-group 0 degree can be fully altered
int indexLimit = getScaleSize() * periodFactorSelected;

Expand Down Expand Up @@ -371,7 +371,7 @@ Array<Point<int>> ScaleStructure::findDegreeMods(int degreeIndex, int chromaLeve
step = stepsToChromas[0] * -chromas;
index = modulo(degreeIndex - step, period);
}


DBG("Degree candidates for modding " + String(groupChain[degreeIndex]) + ":\n\t" + dbgstr);

Expand Down Expand Up @@ -721,7 +721,7 @@ void ScaleStructure::fillSymmetricGrouping(bool applyAlterations)
degreeGroupings.clear();
degreeGroupings.resize(degreeGroupIndexedSizes.size());
degreeGroupScaleSizes.clear();

groupChainDegreeIndicies.resize(period);
degreeGroupChainMap.resize(period);
groupChain.clear();
Expand All @@ -739,7 +739,7 @@ void ScaleStructure::fillSymmetricGrouping(bool applyAlterations)
{
degree = generatorChain[modulo(ind + groupInd + fPeriod * f - generatorOffset, period)];
degreeGroupings.getReference(group).add(degree);

degreeGroupChainMap.set(groupChain.size(), group);
groupChainDegreeIndicies.set(degree, groupChain.size());
groupChain.add(degree);
Expand Down Expand Up @@ -831,7 +831,7 @@ void ScaleStructure::applyChromaAlterations()
for (int g = 0; g < degreeGroupings.size(); g++)
{
Array<int>& group = degreeGroupings.getReference(g);

for (int i = 0; i < group.size(); i++)
{
if (group[i] == degree)
Expand All @@ -845,7 +845,7 @@ void ScaleStructure::applyChromaAlterations()
shiftedGroupIndex = i;
}
}

// Swap the degrees
if (originalGroupNum > -1 && shiftedGroupNum > -1)
{
Expand All @@ -858,7 +858,7 @@ void ScaleStructure::applyChromaAlterations()
// update helper maps
degreeGroupChainMap.set(shiftedIndex, originalGroupNum);
degreeGroupChainMap.set(degIndex, shiftedGroupNum);

break;
}
}
Expand Down Expand Up @@ -923,12 +923,12 @@ Array<Point<int>> ScaleStructure::findIndiciesForGroupResizing(int groupIndexIn)
int groupSize = degreeGroupScaleSizes[groupIndexIn];
int adjGroupIndex = groupIndexIn - 1;

// For now, don't allow resizing of group 0
// For now, don't allow resizing of group 0
if (adjGroupIndex <= 0)
return degreeIndiciesOut;

int adjGroupSize = degreeGroupScaleSizes[adjGroupIndex];
int adjGroupSize = degreeGroupScaleSizes[adjGroupIndex];

int symGroup = getSymmetricGroup(groupIndexIn);
int symAdjGroup = symGroup + 1;

Expand Down Expand Up @@ -1000,7 +1000,7 @@ Array<Point<int>> ScaleStructure::findIndiciesForGroupResizing(int groupIndexIn)
)
continue;
}

if (retainGroupingSymmetry)
degreeIndiciesOut.add({ degIndex + dif, symDegIndex - dif });
else
Expand All @@ -1015,7 +1015,7 @@ Array<Point<int>> ScaleStructure::findIndiciesForGroupResizing(int groupIndexIn)
// skip if sizes are not supported by MOS
if (retainMOSGroupSizes)
dif *= periodFactorSelected;

newSize = groupSize + dif;
adjSize = adjGroupSize - dif;

Expand All @@ -1034,7 +1034,7 @@ Array<Point<int>> ScaleStructure::findIndiciesForGroupResizing(int groupIndexIn)
if (retainMOSGroupSizes)
{
if (
(adjSize >= 0 && scaleSizes.indexOf(newSize / periodFactorSelected) < 0) ||
(adjSize >= 0 && scaleSizes.indexOf(newSize / periodFactorSelected) < 0) ||
(adjSize != 0 && scaleSizes.indexOf(adjSize / periodFactorSelected) < 0)
)
continue;
Expand Down Expand Up @@ -1074,7 +1074,7 @@ Array<Point<int>> ScaleStructure::findIndiciesForGroupSplitting(int groupIndexIn
int groupSizeIndex = degreeGroupIndexedSizes[groupIndexIn];
int groupSize = scaleSizes[groupSizeIndex] * periodFactorSelected;
int symGroup = getSymmetricGroup(groupIndexIn);

// Degree indicies to reference whether group is being split via CCW or CW direction
int ccwDegIndex = groupChain.indexOf(degreeGroupings[groupIndexIn][0]);
int cwDegIndex = ccwDegIndex + groupSize;
Expand Down Expand Up @@ -1109,7 +1109,7 @@ Array<Point<int>> ScaleStructure::findIndiciesForGroupSplitting(int groupIndexIn
int degLimit = groupSize;
if (retainGroupingSymmetry && groupIndexIn == symGroup)
degLimit /= 2;

for (int i = 1, dif = 0; i < indexLimit && dif < degLimit ; i++)
{
if (retainMOSGroupSizes)
Expand Down Expand Up @@ -1279,7 +1279,7 @@ void ScaleStructure::resizeDegreeGroup(int groupIndex, int sizeChangeAmount, boo
{
int adjGroupIndex = groupIndex - 1;
int numGroups = degreeGroupScaleSizes.size();

// makes sure group indicies are not group 0
if (groupIndex < 2 || groupIndex >= numGroups || adjGroupIndex < 1 || adjGroupIndex >= numGroups)
{
Expand Down Expand Up @@ -1309,7 +1309,7 @@ void ScaleStructure::resizeDegreeGroup(int groupIndex, int sizeChangeAmount, boo
}

// results in one less group
else if ((groupIndex == symGroupIndex && abs(sizeChangeAmount) * 2 == groupSize && draggedClockwise) ||
else if ((groupIndex == symGroupIndex && abs(sizeChangeAmount) * 2 == groupSize && draggedClockwise) ||
(adjGroupIndex == symAdjGroup && abs(sizeChangeAmount) * 2 == adjGroupSize && !draggedClockwise))
{
resizeAndMerge = true;
Expand Down Expand Up @@ -1344,15 +1344,15 @@ void ScaleStructure::resizeDegreeGroup(int groupIndex, int sizeChangeAmount, boo
{
if (groupIndex == symGroupIndex)
groupSize -= sizeChangeAmount;

else if (adjGroupIndex == symAdjGroup)
adjGroupSize += sizeChangeAmount;
}
}

int groupSizeIndex = scaleSizes.indexOf(groupSize / periodFactorSelected);
int adjSizeIndex = scaleSizes.indexOf(adjGroupSize / periodFactorSelected);

if (retainMOSGroupSizes)
{
if (groupSizeIndex < 0 || (adjGroupSize != 0 && adjSizeIndex < 0))
Expand All @@ -1374,7 +1374,7 @@ void ScaleStructure::resizeDegreeGroup(int groupIndex, int sizeChangeAmount, boo
newGrouping.add(adjSizeIndex);
newGrouping.add(groupSizeIndex);
}
else if (i != adjGroupIndex & i != symGroupIndex)
else if (i != adjGroupIndex && i != symGroupIndex)
newGrouping.add(degreeGroupIndexedSizes[i]);
}

Expand Down Expand Up @@ -1433,10 +1433,10 @@ void ScaleStructure::mergeDegreeGroups(int groupIndex)
return;
}

int newGroupSize = degreeGroupScaleSizes[groupIndex] + degreeGroupScaleSizes[adjGroupIndex];
int newGroupSize = degreeGroupScaleSizes[groupIndex] + degreeGroupScaleSizes[adjGroupIndex];
int symGroupIndex = getSymmetricGroup(groupIndex);
int symAdjGroup = symGroupIndex + 1;

bool ignoreSymIndicies = !retainGroupingSymmetry;
if (retainGroupingSymmetry)
{
Expand All @@ -1451,7 +1451,7 @@ void ScaleStructure::mergeDegreeGroups(int groupIndex)
ignoreSymIndicies = true;
}
}

int newSizeIndex = scaleSizes.indexOf(newGroupSize / periodFactorSelected);

if (retainMOSGroupSizes && newSizeIndex < 0)
Expand Down Expand Up @@ -1673,7 +1673,7 @@ Array<int> ScaleStructure::getComplimentarySizeGrouping()
num = 0;
}
}

//DBG("Complimentary group:");
//String dbgstr = "";
//for (int i = 0; i < grouping.size(); i++)
Expand Down

0 comments on commit a94c094

Please sign in to comment.