mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cmake framework for cross-platform extensions and building.
This commit is contained in:
parent
604e851423
commit
caecf9b21b
31
extensions/CMakeLists.txt
Normal file
31
extensions/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
project (ACE)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
message(STATUS "No build type selected, default to Debug")
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
endif()
|
||||
|
||||
option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF)
|
||||
option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON)
|
||||
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_CXX_FLAGS "-std=c++11 -march=i686 -m32 -O2 -s -fPIC -fpermissive")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "/D _DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE ACE_COMMON_SOURCES common/*.h common/*.hpp common/*.c common/*.cpp)
|
||||
add_library(ace_common STATIC ${ACE_COMMON_SOURCES})
|
||||
include_directories(AFTER "common")
|
||||
|
||||
# Add extensions to build here
|
||||
add_subdirectory(fcs)
|
||||
|
||||
message("Build Type: ${CMAKE_BUILD_TYPE}")
|
4
extensions/build/.gitignore
vendored
Normal file
4
extensions/build/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
extensions/common/ace_common.cpp
Normal file
4
extensions/common/ace_common.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
int test(int var) {
|
||||
return var;
|
||||
}
|
4
extensions/common/ace_common.h
Normal file
4
extensions/common/ace_common.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
8
extensions/common/targetver.h
Normal file
8
extensions/common/targetver.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#else
|
||||
|
||||
#endif
|
11
extensions/fcs/CMakeLists.txt
Normal file
11
extensions/fcs/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
set(ACE_EXTENSION_NAME "ace_fcs")
|
||||
|
||||
file(GLOB_RECURSE SOURCES *.h *.hpp *.c *.cpp)
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES})
|
||||
add_dependencies(${ACE_EXTENSION_NAME} ace_common)
|
||||
SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
|
||||
endif()
|
@ -11,8 +11,8 @@
|
||||
* Correction to angle
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ace_common.h"
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
|
||||
#include <math.h>
|
@ -1,8 +0,0 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// ace_fcs.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
@ -1,16 +0,0 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
Loading…
Reference in New Issue
Block a user