forked from Neko-Box-Coder/ssGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved tests and examples cmake to their own cmake files
- Loading branch information
1 parent
7069d3e
commit 9635100
Showing
4 changed files
with
184 additions
and
176 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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
function(AddFilesToExecutables folderToExe binSubFolder ideFolderName targetsToLink) | ||
file(GLOB ssGUI_EXE_CPP_FILES "${folderToExe}*.cpp") | ||
|
||
foreach(CUR_SOURCE_PATH ${ssGUI_EXE_CPP_FILES}) | ||
|
||
# Get the file name without path and extension | ||
get_filename_component(CUR_NAME "${CUR_SOURCE_PATH}" NAME_WE) | ||
|
||
# Freetype test | ||
#if(CUR_NAME STREQUAL "FreetypeTest" AND NOT ssGUI_FONT_BACKEND STREQUAL "FreeType") | ||
# continue() | ||
#elseif(CUR_NAME STREQUAL "FreetypeTest" AND ssGUI_FONT_BACKEND STREQUAL "FreeType") | ||
# add_executable("${CUR_NAME}" "${CUR_SOURCE_PATH}") | ||
# target_link_libraries("${CUR_NAME}" PRIVATE freetype) | ||
# continue() | ||
#endif() | ||
|
||
# For now, skip custom graphics example if we are using SFML backend | ||
STRING(TOLOWER ${ssGUI_MAIN_BACKEND} ssGUI_LOWER_MAIN_BACKEND) | ||
if((CUR_NAME STREQUAL "CustomGraphicsExampleV2" OR CUR_NAME STREQUAL "DynamicAtlasTest_Auto") AND NOT ssGUI_LOWER_MAIN_BACKEND MATCHES ".*opengl.*") | ||
continue() | ||
endif() | ||
|
||
# add the executable | ||
add_executable("${CUR_NAME}" "${CUR_SOURCE_PATH}") | ||
|
||
if(CUR_NAME STREQUAL "CustomGraphicsExampleV2") | ||
target_link_libraries("${CUR_NAME}" PRIVATE OpenGL::GL glad) | ||
endif() | ||
|
||
# Link targets | ||
foreach(linkTarget ${targetsToLink}) | ||
target_link_libraries("${CUR_NAME}" PRIVATE ${linkTarget}) | ||
endforeach() | ||
|
||
# Sub-directory for build | ||
set_target_properties("${CUR_NAME}" PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${binSubFolder}) | ||
|
||
# Set folder name for IDEs such as Visual Studio | ||
set_target_properties("${CUR_NAME}" PROPERTIES FOLDER ${ideFolderName}) | ||
|
||
endforeach(CUR_SOURCE_PATH "${ssGUI_EXE_CPP_FILES}") | ||
|
||
#CopyResources(${binSubFolder}) | ||
|
||
endfunction() |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/../../CMakeScripts/Executables.cmake") | ||
|
||
# Check if example resources is populated | ||
file(SIZE "${CMAKE_CURRENT_LIST_DIR}/ExamplesResources.c" EMBEDDED_FILE_SIZE) | ||
if(EMBEDDED_FILE_SIZE LESS 1024) | ||
EMBED_FILES("${CMAKE_CURRENT_LIST_DIR}/ExamplesResources.c" | ||
"${CMAKE_CURRENT_LIST_DIR}/../../Resources/sd.png" | ||
"ssGUI_Example_sd" | ||
"${CMAKE_CURRENT_LIST_DIR}/../../Resources/NotoSans-Bold.ttf" | ||
"ssGUI_Example_NotoSans_Bold;ssLogger") | ||
|
||
file(SIZE "${CMAKE_CURRENT_LIST_DIR}/ExamplesResources.c" EMBEDDED_FILE_SIZE) | ||
if(EMBEDDED_FILE_SIZE LESS 1024) | ||
message(WARNING "Failed to embed example resources") | ||
endif() | ||
endif() | ||
|
||
add_library(ssGUI_Example_Resources "${CMAKE_CURRENT_LIST_DIR}/ExamplesResources.c") | ||
target_include_directories(ssGUI_Example_Resources PUBLIC "${CMAKE_CURRENT_LIST_DIR}") | ||
set_target_properties(ssGUI_Example_Resources PROPERTIES FOLDER "Examples") | ||
|
||
AddFilesToExecutables( "${CMAKE_CURRENT_LIST_DIR}/" | ||
"${CMAKE_CURRENT_BINARY_DIR}/" | ||
"Examples" | ||
"ssGUI;ssGUI_Example_Resources;ssLogger") | ||
|
||
AddFilesToExecutables( "${CMAKE_CURRENT_LIST_DIR}/Playground/" | ||
"${CMAKE_CURRENT_BINARY_DIR}/Playground/" | ||
"Examples/Playground" | ||
"ssGUI;ssGUI_Example_Resources;ssLogger") |
Oops, something went wrong.