aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/src
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/src')
-rw-r--r--cmake/src/CMakeLists.txt81
1 files changed, 47 insertions, 34 deletions
diff --git a/cmake/src/CMakeLists.txt b/cmake/src/CMakeLists.txt
index 08a08197..df0006d3 100644
--- a/cmake/src/CMakeLists.txt
+++ b/cmake/src/CMakeLists.txt
@@ -10,31 +10,60 @@ add_subdirectory(lib)
pascal_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in
${CMAKE_CURRENT_BINARY_DIR}/config-${FPC_PLATFORM}.inc)
-# To conform to the GNU Coding Standards, INSTALL_DATADIR is
-# not hardcoded at configure-time so $prefix and $datadir can be
-# changed at make-time.
-# Paths cannot be passed to fpc via -d as with gcc's -D parameter.
-# We use an intermediate file instead.
-# See [info autoconf], "19.5 How Do I `#define' Installation Directories?"
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/paths.inc
- "INSTALL_DATADIR = '${CMAKE_INSTALL_PREFIX}/share/ultrastardx';")
+# write path to shared data to paths.inc
+if(UNIX AND NOT APPLE)
+ if(IS_ABSOLUTE ${DATADIR})
+ set(usdx_install_datadir "${DATADIR}")
+ else()
+ set(usdx_install_datadir "${CMAKE_INSTALL_PREFIX}/${DATADIR}")
+ endif()
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/paths.inc
+ "INSTALL_DATADIR = '${usdx_install_datadir}';")
+endif()
##
# BUILD
##
+# includes used by ultrastardx
+set(usdx_includes
+ ${CMAKE_CURRENT_BINARY_DIR}/config-${FPC_PLATFORM}.inc
+)
+if(UNIX AND NOT APPLE)
+ list(APPEND usdx_includes ${CMAKE_CURRENT_BINARY_DIR}/paths.inc)
+endif()
+
+# packages by ultrastardx
+set(usdx_packages
+ collections
+ ffmpeg
+ fft
+ freetype
+ sdl
+ sdl_image
+ opengl
+ portaudio
+ portmixer
+ projectm
+ png
+ samplerate
+ sqlite3
+ zlib
+)
+if(WIN32)
+ list(APPEND usdx_packages bass midi)
+endif(WIN32)
#if(DELPHI)
-# PACKAGES ctypes
+# list(APPEND usdx_packages ctypes)
#endif(DELPHI)
-#if(WIN32)
-# PACKAGES bass midi
-#endif(WIN32)
-set(depends)
+# dependencies by ultrastardx
+set(usdx_depends)
if(libprojectM_USE_CWRAPPER)
- list(APPEND depends projectM-cwrapper)
-endif(libprojectM_USE_CWRAPPER)
+ list(APPEND usdx_depends projectM-cwrapper)
+endif()
+# add target for ultrastardx binary
pascal_add_module(ultrastardx ultrastardx.dpr
#FPC_FLAGS -Si -Cs2000000 # maybe set stack size?
OUTPUT_DIR ${USDX_GAME_DIR}
@@ -46,23 +75,7 @@ pascal_add_module(ultrastardx ultrastardx.dpr
screens/*.pas
lib/other/*.pas
../plugins/SDK/*.pas
- INCLUDES
- ${CMAKE_CURRENT_BINARY_DIR}/config-${FPC_PLATFORM}.inc
- ${CMAKE_CURRENT_BINARY_DIR}/paths.inc
- PACKAGES
- collections
- ffmpeg
- fft
- freetype
- sdl
- sdl_image
- opengl
- portaudio
- portmixer
- projectm
- png
- samplerate
- sqlite3
- zlib
- DEPENDS ${depends}
+ INCLUDES ${usdx_includes}
+ PACKAGES ${usdx_packages}
+ DEPENDS ${usdx_depends}
)