mirror of https://github.com/Chlumsky/msdfgen.git
Improve IDE usability by “folderizing” the sources and include headers by default.
This commit is contained in:
parent
02789ca3fd
commit
cba9298f94
|
|
@ -24,6 +24,35 @@ endif()
|
||||||
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||||
#endif()
|
#endif()
|
||||||
|
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
# Support Functions
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
|
||||||
|
# Mirror the folder structure for sources inside the IDE...
|
||||||
|
function(folderize_sources sources prefix)
|
||||||
|
foreach(FILE ${${sources}})
|
||||||
|
get_filename_component(PARENT_DIR "${FILE}" PATH)
|
||||||
|
|
||||||
|
# skip src or include and changes /'s to \\'s
|
||||||
|
string(REPLACE "${prefix}" "" GROUP "${PARENT_DIR}")
|
||||||
|
string(REGEX REPLACE "(\\./)?(src|include)/?" "" GROUP "${GROUP}")
|
||||||
|
string(REPLACE "/" "\\" GROUP "${GROUP}")
|
||||||
|
|
||||||
|
# If it's got a path, then append a "\\" separator (otherwise leave it blank)
|
||||||
|
if ("${GROUP}" MATCHES ".+")
|
||||||
|
set(GROUP "\\${GROUP}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
source_group("${GROUP}" FILES "${FILE}")
|
||||||
|
endforeach()
|
||||||
|
endfunction(folderize_sources)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
file(GLOB_RECURSE msdfgen_HEADERS
|
||||||
|
"core/*.h"
|
||||||
|
"lib/*.h"
|
||||||
|
"ext/*.h")
|
||||||
|
|
||||||
file(GLOB_RECURSE msdfgen_SOURCES
|
file(GLOB_RECURSE msdfgen_SOURCES
|
||||||
"core/*.cpp"
|
"core/*.cpp"
|
||||||
|
|
@ -35,8 +64,10 @@ include_directories(${FREETYPE_INCLUDE_DIRS})
|
||||||
include_directories("include")
|
include_directories("include")
|
||||||
|
|
||||||
# Build the library (aliased name because it's the same target name the exe)
|
# Build the library (aliased name because it's the same target name the exe)
|
||||||
|
folderize_sources(msdfgen_HEADERS ${CMAKE_SOURCE_DIR})
|
||||||
|
folderize_sources(msdfgen_SOURCES ${CMAKE_SOURCE_DIR})
|
||||||
|
|
||||||
add_library(lib_msdfgen ${msdfgen_SOURCES})
|
add_library(lib_msdfgen ${msdfgen_SOURCES} ${msdfgen_HEADERS})
|
||||||
set_target_properties(lib_msdfgen PROPERTIES OUTPUT_NAME msdfgen)
|
set_target_properties(lib_msdfgen PROPERTIES OUTPUT_NAME msdfgen)
|
||||||
target_link_libraries(lib_msdfgen ${FREETYPE_LIBRARIES})
|
target_link_libraries(lib_msdfgen ${FREETYPE_LIBRARIES})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue