Skip to content

Commit

Permalink
Ajout doc/INSIDE.pdf (reverted from commit 3729f9a)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfober committed Sep 2, 2016
1 parent 3729f9a commit 80a876f
Show file tree
Hide file tree
Showing 54 changed files with 1,360 additions and 1,397 deletions.
108 changes: 54 additions & 54 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
project(libmusicxml2)
cmake_minimum_required(VERSION 2.4)
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
endif()

#######################################
Expand All @@ -14,30 +14,30 @@ set (STRVERS "v.3.00")
set (SSTRVERS "3.00")

if(UNIX)
add_definitions(-Wall -DGCC)
add_definitions(-Wall -DGCC)
endif(UNIX)

set (libtype SHARED)
if(APPLE)
if ( IOS STREQUAL "yes" )
message (STATUS "Generates project for iOS - Use -DIOS=no to change.")
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "iPhoneOS")
set (CMAKE_OSX_ARCHITECTURES "armv6 armv7")
set (CMAKE_OSX_SYSROOT "iphoneos5.1")
set (libtype STATIC)
else ()
set (CMAKE_OSX_ARCHITECTURES "x86_64 i386")
if (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0)
set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.8.0)
set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
elseif (${XCODE_VERSION} VERSION_LESS 4.0.0)
set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
else ()
set (CMAKE_OSX_SYSROOT "macosx10.7")
endif ()
set (CMAKE_C++_FLAGS -mmacosx-version-min=10.4)
endif()
if ( IOS STREQUAL "yes" )
message (STATUS "Generates project for iOS - Use -DIOS=no to change.")
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "iPhoneOS")
set (CMAKE_OSX_ARCHITECTURES "armv6 armv7")
set (CMAKE_OSX_SYSROOT "iphoneos5.1")
set (libtype STATIC)
else ()
set (CMAKE_OSX_ARCHITECTURES "x86_64 i386")
if (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0)
set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.8.0)
set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
elseif (${XCODE_VERSION} VERSION_LESS 4.0.0)
set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
else ()
set (CMAKE_OSX_SYSROOT "macosx10.7")
endif ()
set (CMAKE_C++_FLAGS -mmacosx-version-min=10.4)
endif()
endif(APPLE)

if(WIN32)
Expand All @@ -52,23 +52,23 @@ endif(WIN32)

#######################################
# set directories, src and headers.
set (LXML ${CMAKE_CURRENT_SOURCE_DIR}/..)
set (LXMLSRC ${LXML}/src)
set (LXML ${CMAKE_CURRENT_SOURCE_DIR}/..)
set (LXMLSRC ${LXML}/src)
set (LXMLSAMPLE ${LXML}/samples)
set (SRCFOLDERS factory files interface elements guido lilypond lib operations parser visitors)
set (SRCFOLDERS factory files interface elements guido lib operations parser visitors)

foreach(folder ${SRCFOLDERS})
set(SRC ${SRC} "${LXMLSRC}/${folder}/*.cpp") # add source files
set(SRC ${SRC} "${LXMLSRC}/${folder}/*.cpp") # add source files
endforeach(folder)
file (GLOB CORESRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SRC})

foreach(folder ${SRCFOLDERS})
set(HEADERS ${HEADERS} "${LXMLSRC}/${folder}/*.h") # add header files
set(HEADERS ${HEADERS} "${LXMLSRC}/${folder}/*.h") # add header files
endforeach(folder)
file (GLOB COREH RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${HEADERS})

foreach(folder ${SRCFOLDERS})
set(INCL ${INCL} "${LXMLSRC}/${folder}") # add include folders
set(INCL ${INCL} "${LXMLSRC}/${folder}") # add include folders
endforeach(folder)


Expand All @@ -81,57 +81,57 @@ set_source_files_properties (${COREH} PROPERTIES HEADER_FILE_ONLY TRUE)
#######################################
# set library target
if(APPLE)
if (IOS STREQUAL "yes")
set(target musicxml2)
else()
set(target libmusicxml2)
endif()
if (IOS STREQUAL "yes")
set(target musicxml2)
else()
set(target libmusicxml2)
endif()
elseif(MSVC)
set(target libmusicxml2)
set(target libmusicxml2)
else()
set(target musicxml2)
set(target musicxml2)
endif()

if(MSVC)
enable_language(RC)
set(LIBCONTENT ${CORESRC} ${COREH} ${LXML}/win32/libmusicxml/libmusicxml.rc)
enable_language(RC)
set(LIBCONTENT ${CORESRC} ${COREH} ${LXML}/win32/libmusicxml/libmusicxml.rc)
else()
set(LIBCONTENT ${CORESRC} ${COREH})
set(LIBCONTENT ${CORESRC} ${COREH})
endif()

add_library(${target} ${libtype} ${LIBCONTENT})
set_target_properties (${target} PROPERTIES
VERSION ${VERSION}
FRAMEWORK_VERSION ${VERSION}
PUBLIC_HEADER "${COREH}"
DEFINE_SYMBOL LIBMUSICXML_EXPORTS
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${STRVERS}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${SSTRVERS}
VERSION ${VERSION}
FRAMEWORK_VERSION ${VERSION}
PUBLIC_HEADER "${COREH}"
DEFINE_SYMBOL LIBMUSICXML_EXPORTS
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${STRVERS}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${SSTRVERS}
)
if ( IOS STREQUAL "no" )
set_target_properties (${target} PROPERTIES FRAMEWORK TRUE )
set_target_properties (${target} PROPERTIES FRAMEWORK TRUE )
endif()

#######################################
# set sample targets
set (SAMPLES RandomMusic xmlfactory partsummary xml2guido xml2lilypond xmliter countnotes readunrolled xml2midi xmlread xmltranspose xmlclone)
set (TOOLS xml2guido xml2lilypond xmltranspose)
set (SAMPLES RandomMusic xmlfactory partsummary xml2guido xmliter countnotes readunrolled xml2midi xmlread xmltranspose xmlclone)
set (TOOLS xml2guido xmltranspose)

foreach(sample ${SAMPLES})
add_executable( ${sample} ${LXMLSAMPLE}/${sample}.cpp )
target_link_libraries( ${sample} ${target})
add_dependencies(${sample} ${target})
add_executable( ${sample} ${LXMLSAMPLE}/${sample}.cpp )
target_link_libraries( ${sample} ${target})
add_dependencies(${sample} ${target})
endforeach(sample)


#######################################
# install setup
if(NOT APPLE)
install ( TARGETS ${target} ${TOOLS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
FRAMEWORK DESTINATION "/Library/Frameworks" CONFIGURATIONS Release
PUBLIC_HEADER DESTINATION include/libmusicxml
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
FRAMEWORK DESTINATION "/Library/Frameworks" CONFIGURATIONS Release
PUBLIC_HEADER DESTINATION include/libmusicxml
)
endif()
Binary file removed doc/INSIDE.pdf
Binary file not shown.
3 changes: 0 additions & 3 deletions files/misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ clean :
%.gmn: %.xml
xml2guido $< > $@

%.ly: %.xml
xml2lilypond $< > $@


05_long_ago.gmn: 05_long_ago.xml
Alla_faglar.gmn: Alla_faglar.xml
Expand Down
3 changes: 0 additions & 3 deletions files/samples/musicxml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ clean :
%.gmn: %.xml
xml2guido $< > $@

%.ly: %.xml
xml2lilypond $< > $@

ActorPreludeSample.gmn : ActorPreludeSample.xml
BeetAnGeSample.gmn : BeetAnGeSample.xml
Binchois20.gmn : Binchois20.xml
Expand Down
3 changes: 0 additions & 3 deletions files/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ clean :
%.gmn: %.xml
xml2guido $< > $@

%.ly: %.xml
xml2lilypond $< > $@



00a-Basics-Pitches.gmn : 00a-Basics-Pitches.xml
Expand Down
5 changes: 2 additions & 3 deletions linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VPATH = $(subprojects)

CXXFLAGS := -g -O3 -Wall -Wuninitialized $(addprefix -I, $(subprojects))

lib := libmusicxml2.a
lib := ../libmusicxml2.a

all : $(lib) samples

Expand All @@ -20,8 +20,7 @@ $(lib): $(OBJ)
ranlib $(lib)

clean :
# JMI rm -f $(lib) $(OBJ)
rm -f $(OBJ)
rm -f $(lib) $(OBJ)

dep:
makedepend -- $(CXXFLAGS) -- $(SRC)
Expand Down
2 changes: 1 addition & 1 deletion packages/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WINDIR64 := libmusicxml-$(VERSION)-win64

HEADERS = $(wildcard .$(SRCDIR)/*.h) $(wildcard $(SRCDIR)/*/*.h)
FILES = $(SRCDIR)/CHANGELOG.txt ../README.txt ../license.txt
TOOLS = xml2guido xml2lilypond xmltranspose
TOOLS = xml2guido xmltranspose
WINTOOLS32 = $(TOOLS:%=../w32/release/%.exe)
WINTOOLS64 = $(TOOLS:%=../w64/release/%.exe)
MACTOOLS = $(TOOLS:%=$(CMAKEDIR)/Release/%)
Expand Down
8 changes: 2 additions & 6 deletions samples/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
subprojects := elements interface files lib parser visitors guido lilypond operations
subprojects := elements interface files lib parser visitors guido operations

SRC = $(wildcard *.cpp) $(wildcard */*.cpp)
OBJ = $(SRC:.cpp=.o)
LIB = ../linux/libmusicxml2.a
LIB = ../libmusicxml2.a
CXXFLAGS := -g -O3 -Wall -Wuninitialized $(addprefix -I../src/, $(subprojects))

applications := countnotes xmlread xmlclone xmliter xml2guido xml2midi readunrolled randomMusic transpose partsummary
Expand All @@ -11,7 +11,6 @@ all : $(applications)


countnotes: countnotes.cpp
Find /home/user/libmusicxml-git libmusicxml
gcc $(CXXFLAGS) countnotes.cpp $(LIB) -lstdc++ -o countnotes

xmlread: xmlread.cpp
Expand All @@ -26,9 +25,6 @@ xmliter : xmliter.cpp
xml2guido: xml2guido.cpp
gcc $(CXXFLAGS) xml2guido.cpp $(LIB) -lstdc++ -o xml2guido

xml2lilypond: xml2lilypond.cpp
gcc $(CXXFLAGS) xml2lilypond.cpp $(LIB) -lstdc++ -o xml2lilypond

xml2midi: xml2midi.cpp
gcc $(CXXFLAGS) xml2midi.cpp $(LIB) -lstdc++ -o xml2midi

Expand Down
78 changes: 39 additions & 39 deletions samples/countnotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,61 +27,61 @@ using namespace MusicXML2;

//_______________________________________________________________________________
class countnotes :
public visitor<S_note>
public visitor<S_note>
{
public:
int fCount;
public:
int fCount;

countnotes() : fCount(0) {}
virtual ~countnotes() {}
void visitStart( S_note& elt ) { fCount++; }
countnotes() : fCount(0) {}
virtual ~countnotes() {}
void visitStart( S_note& elt ) { fCount++; }
};

//_______________________________________________________________________________
struct predicate {
bool operator () (const Sxmlelement elt) const {
return elt->getType() == k_note;
}
bool operator () (const Sxmlelement elt) const {
return elt->getType() == k_note;
}
};

//_______________________________________________________________________________
static int read(FILE * fd)
{
int count = 0;
xmlreader r;
SXMLFile file = r.read(fd);
if (file) {
Sxmlelement elt = file->elements();
if (elt) {
int count = 0;
xmlreader r;
SXMLFile file = r.read(fd);
if (file) {
Sxmlelement elt = file->elements();
if (elt) {
#ifdef use_visitor
countnotes v;
xml_tree_browser browser(&v);
browser.browse(*elt);
count = v.fCount;
countnotes v;
xml_tree_browser browser(&v);
browser.browse(*elt);
count = v.fCount;
#else // use iterator
predicate p;
count = count_if(elt->begin(), elt->end(), p);
predicate p;
count = count_if(elt->begin(), elt->end(), p);
#endif
}
}
else count = -1;
return count;
}
}
else count = -1;
return count;
}

//_______________________________________________________________________________
int main(int argc, char *argv[]) {
if (argc == 1) {
int count = read (stdin);
if (count >= 0) cout << count << " notes" << endl;
}
else for (int i = 1; i < argc; i++) {
FILE * fd = fopen(argv[i], "r");
if (fd) {
int count = read (fd);
if (count >= 0) cout << argv[i] << ": " << count << " notes" << endl;
fclose(fd);
}
else cerr << "error opening \"" << argv[i] << "\"" << endl;
}
return 0;
if (argc == 1) {
int count = read (stdin);
if (count >= 0) cout << count << " notes" << endl;
}
else for (int i = 1; i < argc; i++) {
FILE * fd = fopen(argv[i], "r");
if (fd) {
int count = read (fd);
if (count >= 0) cout << argv[i] << ": " << count << " notes" << endl;
fclose(fd);
}
else cerr << "error opening \"" << argv[i] << "\"" << endl;
}
return 0;
}
Loading

0 comments on commit 80a876f

Please sign in to comment.