New CMakeFile to cross-compiling

This commit is contained in:
JackCarterSmith 2020-09-09 00:17:10 +02:00
parent 62194ead52
commit 15032331ee
No known key found for this signature in database
GPG Key ID: B05F75E5934B1D7F
2 changed files with 51 additions and 1 deletions

50
CMakeLists.txt Normal file
View File

@ -0,0 +1,50 @@
# CMakeLists.txt
# Written by JackCarterSmith, 2020
# This code is released under the RSE license.
cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
# define project
project(rse-texture VERSION 1.0.1 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
set(CMAKE_BUILD_TYPE Release)
set(RSE_TEX_NAME RSE_Texture-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
include(GNUInstallDirs)
#include(CheckTypeSize)
#include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
# needed packages
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
# define src/headers files
FILE(GLOB RSE_TEX_SRCS src/*.c)
FILE(GLOB RSE_TEX_HRDS src/*.h)
SOURCE_GROUP("Source Files" FILES ${RSE_TEX_SRCS})
SOURCE_GROUP("Header Files" FILES ${RSE_TEX_HRDS})
# begin building RSE-Texture
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(rse-texture ${RSE_TEX_SRCS} ${RSE_TEX_HRDS})
set_target_properties(rse-texture PROPERTIES OUTPUT_NAME ${RSE_TEX_NAME})
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(rse-texture PROPERTIES PREFIX "lib")
set_target_properties(rse-texture PROPERTIES IMPORT_PREFIX "lib")
endif()
target_link_libraries(rse-texture ${ZLIB_LIBRARIES} ${PNG_LIBRARIES})
# install executable
install(TARGETS rse-texture
RUNTIME DESTINATION bin
)

View File

@ -4,7 +4,7 @@ CFLAGS= -Wall -O3
LDFLAGS= -lz -lpng
TARGET=RSE-Texture
VERSION=1.0a
VERSION=1.0b
SRC_DIR=src
SRC= $(wildcard $(SRC_DIR)/*.c)
INCLUDES=-I$(SRC_DIR)