summaryrefslogtreecommitdiff
path: root/test/CMakeLists.txt
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-18 16:17:59 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-21 11:11:03 +0200
commitaf7f485e0692dc2eff7da057b6ecd038032ce8ec (patch)
tree10ff42e0fa92aba6f5d572ce5d7013ac01298a01 /test/CMakeLists.txt
parent11dec24ccf699f79005099fe50762c9147d07901 (diff)
Consolidate test/demo for all build systems
This is an attempt to unify the code for all build systems (CMake, autotools with make), platforms (operating systems) and toolchains (make + gcc/clang, Visual Studio IDE, Xcode ...) to avoid duplicate code and clarify the differences for future devs and to simplify maintenance. The goal is to minimize the platform specific code. Much of the new code are comments to describe the different situations. The main program does now all the "hard work" to construct the paths necessary to access the other applications and data files. Use macOS specific code to determine the application path (app_path) in main() instead of function dobut(), when test apps are activated. Remove obsolete comments and dead code. Tested on Windows and Linux with both autotools/configure/make and CMake with make (Linux + MinGW), Visual Studio.
Diffstat (limited to 'test/CMakeLists.txt')
-rw-r--r--test/CMakeLists.txt19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f1265978c..b477d6647 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -15,8 +15,8 @@
#
#######################################################################
-set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../bin/examples)
-set (TESTFILE_PATH ${EXECUTABLE_OUTPUT_PATH})
+set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../bin)
+set (TESTFILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/../data)
include (../CMake/FLTK-Functions.cmake)
include (../CMake/fl_create_example.cmake)
@@ -204,13 +204,11 @@ endif (NOT ANDROID)
# We need some support files for the demo programs:
-# Note: this is incomplete as of 11 Feb 2015
-# Todo: currently all files are copied, but some of them need configuration:
-# - demo.menu: fluid can't be started (wrong path)
+# Note: this is incomplete as of July 2020
+# Todo: currently all files are copied, but some of them may need configuration:
# - demo.menu: help_dialog (help_dialog.html) can't find its images (not copied)
-# - maybe more ...
-# create data directory for test and demo programs
+# create data directory for test and demo programs if it doesn't exist
file (MAKE_DIRECTORY ${TESTFILE_PATH})
# copy the test files
@@ -221,13 +219,16 @@ file (COPY
DESTINATION ${TESTFILE_PATH}
)
+# the main test program 'demo' needs additional hints and configurations
+
+target_compile_definitions (demo PRIVATE GENERATED_BY_CMAKE)
+target_compile_definitions (demo PRIVATE CMAKE_SOURCE_PATH="${CMAKE_CURRENT_SOURCE_DIR}")
+
# Apple macOS creates bundles instead of executables and needs a little bit
# more help for demos to run correctly
if (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL))
- target_compile_definitions (demo PUBLIC USING_XCODE)
-
# make the menu structure part of the app
target_sources (demo PRIVATE demo.menu)
set_target_properties (demo PROPERTIES MACOSX_BUNDLE TRUE RESOURCE demo.menu)